From b4fe64bf9e4bdef35768b82388d89fa308c2df3e Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 28 Dec 2008 15:50:01 -0800 Subject: [PATCH] *Really* make :ugly benchmarking work. I hope. --- test/benchmark.rb | 8 ++-- test/haml/templates/_av_partial_1_ugly.haml | 9 ++++ test/haml/templates/_av_partial_2_ugly.haml | 5 ++ test/haml/templates/action_view_link.haml | 1 - test/haml/templates/action_view_ugly.haml | 47 +++++++++++++++++++ ...{standard_link.haml => standard_ugly.haml} | 0 6 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 test/haml/templates/_av_partial_1_ugly.haml create mode 100644 test/haml/templates/_av_partial_2_ugly.haml delete mode 120000 test/haml/templates/action_view_link.haml create mode 100644 test/haml/templates/action_view_ugly.haml rename test/haml/templates/{standard_link.haml => standard_ugly.haml} (100%) diff --git a/test/benchmark.rb b/test/benchmark.rb index c63f6e1c..2bb8160d 100755 --- a/test/benchmark.rb +++ b/test/benchmark.rb @@ -70,8 +70,8 @@ RBench.run(times) do erb { render @base, 'haml/rhtml/standard' } Haml::Template.options[:ugly] = true - render @base, 'haml/templates/standard_link' - haml_ugly { render @base, 'haml/templates/standard_link' } + render @base, 'haml/templates/standard_ugly' + haml_ugly { render @base, 'haml/templates/standard_ugly' } end report "ActionView with deep partials" do @@ -87,8 +87,8 @@ RBench.run(times) do erb { render @base, 'haml/rhtml/action_view' } Haml::Template.options[:ugly] = true - render @base, 'haml/templates/action_view_link' - haml_ugly { render @base, 'haml/templates/action_view_link' } + render @base, 'haml/templates/action_view_ugly' + haml_ugly { render @base, 'haml/templates/action_view_ugly' } end end diff --git a/test/haml/templates/_av_partial_1_ugly.haml b/test/haml/templates/_av_partial_1_ugly.haml new file mode 100644 index 00000000..73e0ca7a --- /dev/null +++ b/test/haml/templates/_av_partial_1_ugly.haml @@ -0,0 +1,9 @@ +%h2 This is a pretty complicated partial +.partial + %p It has several nested partials, + %ul + - 5.times do + %li + %strong Partial: + - @nesting = 5 + = render :partial => 'haml/templates/av_partial_2_ugly' \ No newline at end of file diff --git a/test/haml/templates/_av_partial_2_ugly.haml b/test/haml/templates/_av_partial_2_ugly.haml new file mode 100644 index 00000000..088a3c36 --- /dev/null +++ b/test/haml/templates/_av_partial_2_ugly.haml @@ -0,0 +1,5 @@ +- @nesting -= 1 +.partial{:level => @nesting} + %h3 This is a crazy deep-nested partial. + %p== Nesting level #{@nesting} + = render :partial => 'haml/templates/av_partial_2_ugly' if @nesting > 0 \ No newline at end of file diff --git a/test/haml/templates/action_view_link.haml b/test/haml/templates/action_view_link.haml deleted file mode 120000 index f3ed92a4..00000000 --- a/test/haml/templates/action_view_link.haml +++ /dev/null @@ -1 +0,0 @@ -action_view.haml \ No newline at end of file diff --git a/test/haml/templates/action_view_ugly.haml b/test/haml/templates/action_view_ugly.haml new file mode 100644 index 00000000..5f0551ed --- /dev/null +++ b/test/haml/templates/action_view_ugly.haml @@ -0,0 +1,47 @@ +!!! +%html{html_attrs} + %head + %title Hampton Catlin Is Totally Awesome + %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"} + %body + %h1 + This is very much like the standard template, + except that it has some ActionView-specific stuff. + It's only used for benchmarking. + .crazy_partials= render :partial => 'haml/templates/av_partial_1_ugly' + / You're In my house now! + .header + Yes, ladies and gentileman. He is just that egotistical. + Fantastic! This should be multi-line output + The question is if this would translate! Ahah! + = 1 + 9 + 8 + 2 #numbers should work and this should be ignored + #body= " Quotes should be loved! Just like people!" + - 120.times do |number| + - number + Wow.| + %p + = "Holy cow " + | + "multiline " + | + "tags! " + | + "A pipe (|) even!" | + = [1, 2, 3].collect { |n| "PipesIgnored|" } + = [1, 2, 3].collect { |n| | + n.to_s | + }.join("|") | + %div.silent + - foo = String.new + - foo << "this" + - foo << " shouldn't" + - foo << " evaluate" + = foo + " but now it should!" + -# Woah crap a comment! + + -# That was a line that shouldn't close everything. + %ul.really.cool + - ('a'..'f').each do |a| + %li= a + #combo.of_divs_with_underscore= @should_eval = "with this text" + = [ 104, 101, 108, 108, 111 ].map do |byte| + - byte.chr + .footer + %strong.shout= "This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid. \nSo, I'm just making it *really* long. God, I hope this works" diff --git a/test/haml/templates/standard_link.haml b/test/haml/templates/standard_ugly.haml similarity index 100% rename from test/haml/templates/standard_link.haml rename to test/haml/templates/standard_ugly.haml