Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / test / testVariableAndMethod.rb
blobe15334b59620fa5b8150f9dc83fc189777a8484f
1 require 'test/minirunit'
2 test_check "Test Variables and method:"
3 a = String.new("Hello World")
4 b = a.reverse
5 c = " "
6 d = "Hello".reverse
7 e = a[6, 5].reverse
9 f = 100 + 35
10 g =  2 * 10
11 h = 13 % 5
12 test_ok("Hello World" ==  a)
13 test_ok("dlroW olleH" == b)
14 test_ok("Hello" == d.reverse)
15 test_ok("World" == e.reverse)
16 test_ok(135 == f)
17 test_ok(20 == g)
18 test_ok(3 == h)
19 $a = a
20 $b = b
21 $c = c
22 $d = d
23 $e = e
24 $f = f
25 $g = g
26 $h = h
27 NIL_CONSTANT=nil
28 test_ok(NIL_CONSTANT == nil)
29 test_exception(NameError) { NO_SUCH_CONSTANT }
31 x, (y, z) = 1, 2, 3; test_ok([1,2,nil] == [x,y,z])