test/something.rb in ParseTree-1.4.1 vs test/something.rb in ParseTree-1.5.0
- old
+ new
@@ -1,8 +1,12 @@
class Something
+ def self.classmethod
+ 1 + 1
+ end
+
# basically: do we work at all?
def empty
end
# First order transformation: basic language constructs
@@ -54,17 +58,21 @@
end
def iteration1
array = [1, 2, 3]
array.each do |x|
- puts(x.to_s)
+ y = x.to_s
+ puts(y)
end
end
def iteration2
array = [1, 2, 3]
- array.each { |x| puts(x.to_s) }
+ array.each { |x|
+ y = x.to_s
+ puts(y)
+ }
end
def iteration3
array1 = [1, 2, 3]
array2 = [4, 5, 6, 7]
@@ -181,9 +189,39 @@
else
4
ensure
5
end
+ end
+
+ def bbegin_no_exception
+ begin
+ 5
+ rescue
+ 6
+ end
+ end
+
+ def op_asgn
+ a = 0
+ a ||= 1
+ a &&= 2
+ #a += 3 # doesn't use op_asgn
+
+ b = []
+ b[1] ||= 10
+ b[2] &&= 11
+ b[3] += 12
+
+ s = Struct.new :var
+ c = s.new nil
+ c.var ||= 20
+ c.var &&= 21
+ c.var += 22
+
+ c.d.e.f ||= 42
+
+ return a
end
def whiles
while false do
puts "false"