From 3b4a0d83ddd0eec0dc424798ad8ed3a53c5ba88c Mon Sep 17 00:00:00 2001 From: murphy Date: Wed, 22 Feb 2006 13:48:59 +0000 Subject: New Test: test/ruby/tk-calc.in.rb. Thanks to mawe. --- test/ruby/tk-calc.in.rb | 5 +++++ test/ruby/tk-calc.out.raydebug | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 test/ruby/tk-calc.in.rb create mode 100644 test/ruby/tk-calc.out.raydebug diff --git a/test/ruby/tk-calc.in.rb b/test/ruby/tk-calc.in.rb new file mode 100644 index 0000000..76272da --- /dev/null +++ b/test/ruby/tk-calc.in.rb @@ -0,0 +1,5 @@ +require 'tk';TkRoot.new;r,c,b=1,1,%w#7 8 9 + 4 5 6 - 1 2 3 * 0 . /#;d=TkEntry.new{ +grid("row"=>0,"column"=>1,"columnspan"=>4)};b.each_index{|i|TkButton.new{text b[i] +command proc{d.insert("end",b[i])};grid("row"=>r,"column"=>c)};c+=1;if i&&(i+1)%## +4==0then r+=1;c=1 end};TkButton.new{text"=";command proc{t=d.get;d.delete(0,"end") +d.insert("end",eval(t))};grid("row"=>r,"column"=>c)};Tk.mainloop### by mawe :) ### diff --git a/test/ruby/tk-calc.out.raydebug b/test/ruby/tk-calc.out.raydebug new file mode 100644 index 0000000..09460c9 --- /dev/null +++ b/test/ruby/tk-calc.out.raydebug @@ -0,0 +1,5 @@ +ident(require) stringoperator(;)constant(TkRoot)operator(.)ident(new)operator(;)ident(r)operator(,)ident(c)operator(,)ident(b)operator(=)integer(1)operator(,)integer(1)operator(,)stringoperator(;)ident(d)operator(=)constant(TkEntry)operator(.)ident(new)operator({) +ident(grid)operator(()stringoperator(=)operator(>)integer(0)operator(,)stringoperator(=)operator(>)integer(1)operator(,)stringoperator(=)operator(>)integer(4)operator(\))operator(})operator(;)ident(b)operator(.)ident(each_index)operator({)operator(|)ident(i)operator(|)constant(TkButton)operator(.)ident(new)operator({)ident(text) ident(b)operator([)ident(i)operator(]) +ident(command) ident(proc)operator({)ident(d)operator(.)ident(insert)operator(()stringoperator(,)ident(b)operator([)ident(i)operator(])operator(\))operator(})operator(;)ident(grid)operator(()stringoperator(=)operator(>)ident(r)operator(,)stringoperator(=)operator(>)ident(c)operator(\))operator(})operator(;)ident(c)operator(+=)integer(1)operator(;)reserved(if) ident(i)operator(&&)operator(()ident(i)integer(+1)operator(\))operator(%)comment(##) +integer(4)operator(==)integer(0)reserved(then) ident(r)operator(+=)integer(1)operator(;)ident(c)operator(=)integer(1) reserved(end)operator(})operator(;)constant(TkButton)operator(.)ident(new)operator({)ident(text)stringoperator(;)ident(command) ident(proc)operator({)ident(t)operator(=)ident(d)operator(.)ident(get)operator(;)ident(d)operator(.)ident(delete)operator(()integer(0)operator(,)stringoperator(\)) +ident(d)operator(.)ident(insert)operator(()stringoperator(,)ident(eval)operator(()ident(t)operator(\))operator(\))operator(})operator(;)ident(grid)operator(()stringoperator(=)operator(>)ident(r)operator(,)stringoperator(=)operator(>)ident(c)operator(\))operator(})operator(;)constant(Tk)operator(.)ident(mainloop)comment(### by mawe :\) ###) -- cgit v1.2.1