2003-09-04 12:18:59 -04:00
|
|
|
require 'test/unit'
|
|
|
|
|
|
|
|
$KCODE = 'none'
|
|
|
|
|
|
|
|
class TestTrace < Test::Unit::TestCase
|
|
|
|
def test_trace
|
|
|
|
$x = 1234
|
|
|
|
$y = 0
|
|
|
|
trace_var :$x, proc{$y = $x}
|
|
|
|
$x = 40414
|
2003-09-05 11:15:43 -04:00
|
|
|
assert_equal($x, $y)
|
2003-09-06 13:27:58 -04:00
|
|
|
|
2003-09-04 12:18:59 -04:00
|
|
|
untrace_var :$x
|
|
|
|
$x = 19660208
|
2003-09-06 13:27:58 -04:00
|
|
|
assert_not_equal($x, $y)
|
|
|
|
|
2003-09-04 12:18:59 -04:00
|
|
|
trace_var :$x, proc{$x *= 2}
|
|
|
|
$x = 5
|
2003-09-05 11:15:43 -04:00
|
|
|
assert_equal(10, $x)
|
2003-09-06 13:27:58 -04:00
|
|
|
|
2003-09-04 12:18:59 -04:00
|
|
|
untrace_var :$x
|
2003-09-05 11:15:43 -04:00
|
|
|
end
|
2003-09-04 12:18:59 -04:00
|
|
|
end
|