PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

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

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