Skip to content
This repository
  • 9 commits
  • 13 files changed
  • 0 comments
  • 1 contributor
16 .travis.yml
@@ -2,7 +2,7 @@ rvm:
2 2 - 1.8.7
3 3 - 1.9.3
4 4 - jruby-18mode
5   - # - rbx-18mode
  5 + - rbx-18mode
6 6 gemfile:
7 7 - test/gemfiles/Gemfile.rails-2.0.x
8 8 - test/gemfiles/Gemfile.rails-2.1.x
@@ -27,13 +27,13 @@ matrix:
27 27 - { rvm: jruby-18mode, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
28 28 - { rvm: jruby-18mode, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
29 29
30   - # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.0.x }
31   - # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.1.x }
32   - # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.2.x }
33   - # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.3.x }
34   - # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-xss-2.3.x }
35   - # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
36   - # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
  30 + - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.0.x }
  31 + - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.1.x }
  32 + - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.2.x }
  33 + - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.3.x }
  34 + - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-xss-2.3.x }
  35 + - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
  36 + - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
37 37 branches:
38 38 only:
39 39 - master
6 README.md
Source Rendered
@@ -119,6 +119,12 @@ You'll get a warning that you need to install haml-spec, so run this:
119 119 At this point `rake` should run without error or warning and you are ready to
120 120 start working on your patch!
121 121
  122 +Note that you can also run just one test out of the test suite if you're working
  123 +on a specific area:
  124 +
  125 + ruby -Itest test/helper_test.rb -n test_buffer_access
  126 +
  127 +
122 128 ## Authors
123 129
124 130 Haml was created by [Hampton Catlin](http://hamptoncatlin.com), the author of
2  Rakefile
@@ -12,7 +12,7 @@ task :benchmark do
12 12 end
13 13
14 14 Rake::TestTask.new do |t|
15   - t.libs << 'lib'
  15 + t.libs << 'lib' << 'test'
16 16 t.test_files = Dir["test/**/*_test.rb"]
17 17 t.verbose = true
18 18 end
0  test/benchmark.rb → benchmark.rb
File renamed without changes
4 lib/haml/helpers.rb
@@ -369,7 +369,9 @@ def capture_haml(*args, &block)
369 369
370 370 captured = haml_buffer.buffer.slice!(position..-1)
371 371 return captured if haml_buffer.options[:ugly]
372   - captured = captured.split(/^/)
  372 + # Note that the "reject" is needed for rbx 1.2.4, which includes empty
  373 + # strings in the returned array when splitting by /^/.
  374 + captured = captured.split(/^/).reject {|x| x == ""}
373 375
374 376 min_tabs = nil
375 377 captured.each do |line|
29 test/engine_test.rb
... ... @@ -1,5 +1,5 @@
1 1 # -*- coding: utf-8 -*-
2   -require File.dirname(__FILE__) + '/test_helper'
  2 +require 'test_helper'
3 3
4 4 class EngineTest < MiniTest::Unit::TestCase
5 5 # A map of erroneous Haml documents to the error messages they should produce.
@@ -64,8 +64,8 @@ class EngineTest < MiniTest::Unit::TestCase
64 64 "%p{:foo => }" => :compile,
65 65 "%p{=> 'bar'}" => :compile,
66 66 "%p{'foo => 'bar'}" => :compile,
67   - "%p{:foo => 'bar}" => :unterminated_string,
68   - "%p{:foo => 'bar\"}" => :unterminated_string,
  67 + "%p{:foo => 'bar}" => :compile,
  68 + "%p{:foo => 'bar\"}" => :compile,
69 69
70 70 # Regression tests
71 71 "- raise 'foo'\n\n\n\nbar" => ["foo", 1],
@@ -1084,7 +1084,9 @@ def test_filename_and_line
1084 1084 render("\n\n= 123\n\n= nil[]", :filename => 'test', :line => 2)
1085 1085 rescue Exception => e
1086 1086 assert_kind_of NoMethodError, e
1087   - assert_match(/test:6/, e.backtrace.first)
  1087 + backtrace = e.backtrace
  1088 + backtrace.shift if rubinius?
  1089 + assert_match(/test:6/, backtrace.first)
1088 1090 end
1089 1091 end
1090 1092
@@ -1216,18 +1218,9 @@ def test_dynamic_attrs_with_self_closed_tag
1216 1218 expected_message, line_no = value
1217 1219 line_no ||= key.split("\n").length
1218 1220
  1221 +
1219 1222 if expected_message == :compile
1220   - if RUBY_VERSION < "1.9" && !jruby?
1221   - assert_match(/^compile error\n/, err.message, "Line: #{key}")
1222   - else
1223   - assert_match(/^#{Regexp.quote __FILE__}:#{line_no}: syntax error,/, err.message, "Line: #{key}")
1224   - end
1225   - elsif expected_message == :unterminated_string
1226   - if jruby?
1227   - assert_match(/^#{Regexp.quote __FILE__}:#{line_no}: unterminated string meets end of file/, err.message, "Line: #{key}")
1228   - else
1229   - assert_match(/^#{Regexp.quote __FILE__}:#{line_no}: syntax error,/, err.message, "Line: #{key}")
1230   - end
  1223 + assert_match(/(compile error|syntax error|unterminated string|expecting)/, err.message, "Line: #{key}")
1231 1224 else
1232 1225 assert_equal(expected_message, err.message, "Line: #{key}")
1233 1226 end
@@ -1263,7 +1256,9 @@ def test_exception_line
1263 1256 def test_exception
1264 1257 render("%p\n hi\n %a= undefined\n= 12")
1265 1258 rescue Exception => e
1266   - assert_match("(test_exception):3", e.backtrace[0])
  1259 + backtrace = e.backtrace
  1260 + backtrace.shift if rubinius?
  1261 + assert_match("(test_exception):3", backtrace[0])
1267 1262 else
1268 1263 # Test failed... should have raised an exception
1269 1264 assert(false)
@@ -1272,7 +1267,7 @@ def test_exception
1272 1267 def test_compile_error
1273 1268 render("a\nb\n- fee)\nc")
1274 1269 rescue Exception => e
1275   - assert_match(/\(test_compile_error\):3: syntax error/i, e.message)
  1270 + assert_match(/\(test_compile_error\):3: (syntax error|expecting \$end)/i, e.message)
1276 1271 else
1277 1272 assert(false,
1278 1273 '"a\nb\n- fee)\nc" doesn\'t produce an exception!')
4 test/helper_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.dirname(__FILE__) + '/test_helper'
  1 +require 'test_helper'
2 2
3 3 class ActionView::Base
4 4 def nested_tag
@@ -167,7 +167,7 @@ def test_capture_haml
167 167 - (foo = capture_haml(13) do |a|
168 168 %p= a
169 169 - end; nil)
170   -= foo.dump
  170 += foo.inspect
171 171 HAML
172 172 end
173 173
4 test/html2haml_test.rb
... ... @@ -1,5 +1,5 @@
1   -require File.dirname(__FILE__) + '/test_helper'
2   -require File.dirname(__FILE__) + '/html2haml/erb_tests'
  1 +require 'test_helper'
  2 +require 'html2haml/erb_tests'
3 3 require 'haml/html'
4 4
5 5 class Html2HamlTest < MiniTest::Unit::TestCase
2  test/results/silent_script.xhtml
@@ -50,7 +50,7 @@
50 50 <li>z</li>
51 51 </ul>
52 52 <h1>I can catch errors!</h1>
53   - Oh no! "undefined method `silly' for String:Class" happened!
  53 + Oh no! "foo" happened!
54 54 <p>
55 55 "false" is:
56 56 false
4 test/template_test.rb
... ... @@ -1,6 +1,6 @@
1   -require File.dirname(__FILE__) + '/test_helper'
  1 +require 'test_helper'
2 2 require 'sass/plugin'
3   -require File.dirname(__FILE__) + '/mocks/article'
  3 +require 'mocks/article'
4 4
5 5 require 'action_pack/version'
6 6
4 test/templates/silent_script.haml
@@ -8,8 +8,8 @@
8 8 %li= i
9 9 %h1 I can catch errors!
10 10 - begin
11   - - String.silly
12   - - rescue NameError => e
  11 + - raise "foo"
  12 + - rescue RuntimeError => e
13 13 = "Oh no! \"#{e}\" happened!"
14 14 %p
15 15 "false" is:
4 test/test_helper.rb
... ... @@ -1,6 +1,6 @@
1 1 require 'rubygems'
2 2 require 'bundler/setup'
3   -require "test/unit" # On JRuby, tests won't run unless we include this WTF
  3 +require 'test/unit' # On JRuby, tests won't run unless we include this. WTF?
4 4 require 'minitest/autorun'
5 5 require 'action_pack'
6 6 require 'action_controller'
@@ -23,8 +23,8 @@ class TestApp < Rails::Application
23 23
24 24 require 'fileutils'
25 25 require 'haml'
26   -
27 26 require 'haml/template'
  27 +
28 28 Haml::Template.options[:ugly] = false
29 29 Haml::Template.options[:format] = :xhtml
30 30
3  test/util_test.rb
... ... @@ -1,5 +1,4 @@
1   -require File.dirname(__FILE__) + '/test_helper'
2   -require 'pathname'
  1 +require 'test_helper'
3 2
4 3 class UtilTest < MiniTest::Unit::TestCase
5 4 include Haml::Util

No commit comments for this range

Something went wrong with that request. Please try again.