summaryrefslogtreecommitdiff
path: root/test/test-main.rb
diff options
context:
space:
mode:
author(no author) <(no author)@c9e70521-770b-0410-b9ac-ce6205b42a9f>2007-02-02 13:28:17 +0000
committer(no author) <(no author)@c9e70521-770b-0410-b9ac-ce6205b42a9f>2007-02-02 13:28:17 +0000
commitc0d6a4d75427b00dc8273572dbea925a802bc650 (patch)
treec59b658fe700c096ddf0aea7a68c09f572c8c585 /test/test-main.rb
parent5a2ef01fa688230d5c62072a94b4f068159b86f5 (diff)
downloaderubis-c0d6a4d75427b00dc8273572dbea925a802bc650.tar.gz
- [change] main.rb: option '-c class' is renamed to '-C'
- [enhance] main.rb: option '-c context' supported - [refactor] tiny.rb: prefix '_' is aded to local vars in TinyEruby#evaluate() and PI::TinyEruby#evaluate() - [refactor] tiny.rb: method 'escape_text() is inlined in TinyEruby and PI::TinyEruby classes - [enhance] add test for PI::TinyEruby - [change] erubybench.rb: default output file is changed to '/dev/null' - [change] erubybench.rb: options '-F' is changed to '-t' - [change] erubybench.rb: options '-T' is changed to '-m' - [change] erubybench.rb: don't convert string keys of context data into symbol - [change] erubybench.yaml: add price, change, and ratio - [change] erubybench.rhtml: add price, change, and ratio
Diffstat (limited to 'test/test-main.rb')
-rw-r--r--test/test-main.rb27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/test-main.rb b/test/test-main.rb
index 85231b1..50d9d3b 100644
--- a/test/test-main.rb
+++ b/test/test-main.rb
@@ -196,10 +196,10 @@ END
end
- def test_class1 # -c
+ def test_class1 # -C
@input = INPUT
@expected = OUTPUT.gsub(/<aaa>/, '&lt;aaa&gt;').gsub(/b&b/, 'b&amp;b').gsub(/"ccc"/, '&quot;ccc&quot;')
- @options = "-c XmlEruby"
+ @options = "-C XmlEruby"
_test()
end
@@ -331,7 +331,7 @@ END
end
- def test_context1 # -B
+ def test_result1 # -B
yamlfile = "test.context4.yaml"
#
@input = <<'END'
@@ -364,6 +364,27 @@ END
end
+ def test_context1 # -c
+ @input = <<'END'
+user = <%= @user %>
+<% for item in @list %>
+ - <%= item %>
+<% end %>
+END
+ @expected = <<'END'
+user = World
+ - aaa
+ - bbb
+ - ccc
+END
+ #
+ @options = ['-c', '{user: World, list: [aaa, bbb, ccc]}']
+ _test()
+ @options = ['-c', '@user="World"; @list=%w[aaa bbb ccc]']
+ _test()
+ end
+
+
def test_include1 # -I
dir = 'foo'
lib = 'bar'