PageRenderTime 19ms CodeModel.GetById 9ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/ruby/constants/runme.rb

#
Ruby | 25 lines | 20 code | 4 blank | 1 comment | 0 complexity | 02d42612cfd56434155f8ececef73356 MD5 | raw file
 1# file: runme.rb
 2
 3require 'example'
 4
 5print "ICONST  = ", Example::ICONST,  " (should be 42)\n"
 6print "FCONST  = ", Example::FCONST,  " (should be 2.1828)\n"
 7print "CCONST  = ", Example::CCONST,  " (should be 'x')\n"
 8print "CCONST2 = ", Example::CCONST2, " (this should be on a new line)\n"
 9print "SCONST  = ", Example::SCONST,  " (should be 'Hello World')\n"
10print "SCONST2 = ", Example::SCONST2, " (should be '\"Hello World\"')\n"
11print "EXPR    = ", Example::EXPR,    " (should be 48.5484)\n"
12print "iconst  = ", Example::Iconst,  " (should be 37)\n"
13print "fconst  = ", Example::Fconst,  " (should be 3.14)\n"
14
15begin
16  print "EXTERN = ", Example::EXTERN, " (Arg! This shouldn't print anything)\n"
17rescue NameError
18  print "EXTERN isn't defined (good)\n"
19end
20
21begin
22  print "FOO    = ", Example::FOO, " (Arg! This shouldn't print anything)\n"
23rescue NameError
24  print "FOO isn't defined (good)\n"
25end