Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: haml/haml
...
head fork: haml/haml
Checking mergeability… Don't worry, you can still create the pull request.
  • 9 commits
  • 13 files changed
  • 0 commit comments
  • 1 contributor
View
16 .travis.yml
@@ -2,7 +2,7 @@ rvm:
- 1.8.7
- 1.9.3
- jruby-18mode
- # - rbx-18mode
+ - rbx-18mode
gemfile:
- test/gemfiles/Gemfile.rails-2.0.x
- test/gemfiles/Gemfile.rails-2.1.x
@@ -27,13 +27,13 @@ matrix:
- { rvm: jruby-18mode, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
- { rvm: jruby-18mode, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
- # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.0.x }
- # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.1.x }
- # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.2.x }
- # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.3.x }
- # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-xss-2.3.x }
- # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
- # - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
+ - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.0.x }
+ - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.1.x }
+ - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.2.x }
+ - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-2.3.x }
+ - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-xss-2.3.x }
+ - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
+ - { rvm: rbx-18mode, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
branches:
only:
- master
View
6 README.md
@@ -119,6 +119,12 @@ You'll get a warning that you need to install haml-spec, so run this:
At this point `rake` should run without error or warning and you are ready to
start working on your patch!
+Note that you can also run just one test out of the test suite if you're working
+on a specific area:
+
+ ruby -Itest test/helper_test.rb -n test_buffer_access
+
+
## Authors
Haml was created by [Hampton Catlin](http://hamptoncatlin.com), the author of
View
2  Rakefile
@@ -12,7 +12,7 @@ task :benchmark do
end
Rake::TestTask.new do |t|
- t.libs << 'lib'
+ t.libs << 'lib' << 'test'
t.test_files = Dir["test/**/*_test.rb"]
t.verbose = true
end
View
0  test/benchmark.rb → benchmark.rb
File renamed without changes
View
4 lib/haml/helpers.rb
@@ -369,7 +369,9 @@ def capture_haml(*args, &block)
captured = haml_buffer.buffer.slice!(position..-1)
return captured if haml_buffer.options[:ugly]
- captured = captured.split(/^/)
+ # Note that the "reject" is needed for rbx 1.2.4, which includes empty
+ # strings in the returned array when splitting by /^/.
+ captured = captured.split(/^/).reject {|x| x == ""}
min_tabs = nil
captured.each do |line|
View
29 test/engine_test.rb
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-require File.dirname(__FILE__) + '/test_helper'
+require 'test_helper'
class EngineTest < MiniTest::Unit::TestCase
# A map of erroneous Haml documents to the error messages they should produce.
@@ -64,8 +64,8 @@ class EngineTest < MiniTest::Unit::TestCase
"%p{:foo => }" => :compile,
"%p{=> 'bar'}" => :compile,
"%p{'foo => 'bar'}" => :compile,
- "%p{:foo => 'bar}" => :unterminated_string,
- "%p{:foo => 'bar\"}" => :unterminated_string,
+ "%p{:foo => 'bar}" => :compile,
+ "%p{:foo => 'bar\"}" => :compile,
# Regression tests
"- raise 'foo'\n\n\n\nbar" => ["foo", 1],
@@ -1084,7 +1084,9 @@ def test_filename_and_line
render("\n\n= 123\n\n= nil[]", :filename => 'test', :line => 2)
rescue Exception => e
assert_kind_of NoMethodError, e
- assert_match(/test:6/, e.backtrace.first)
+ backtrace = e.backtrace
+ backtrace.shift if rubinius?
+ assert_match(/test:6/, backtrace.first)
end
end
@@ -1216,18 +1218,9 @@ def test_dynamic_attrs_with_self_closed_tag
expected_message, line_no = value
line_no ||= key.split("\n").length
+
if expected_message == :compile
- if RUBY_VERSION < "1.9" && !jruby?
- assert_match(/^compile error\n/, err.message, "Line: #{key}")
- else
- assert_match(/^#{Regexp.quote __FILE__}:#{line_no}: syntax error,/, err.message, "Line: #{key}")
- end
- elsif expected_message == :unterminated_string
- if jruby?
- assert_match(/^#{Regexp.quote __FILE__}:#{line_no}: unterminated string meets end of file/, err.message, "Line: #{key}")
- else
- assert_match(/^#{Regexp.quote __FILE__}:#{line_no}: syntax error,/, err.message, "Line: #{key}")
- end
+ assert_match(/(compile error|syntax error|unterminated string|expecting)/, err.message, "Line: #{key}")
else
assert_equal(expected_message, err.message, "Line: #{key}")
end
@@ -1263,7 +1256,9 @@ def test_exception_line
def test_exception
render("%p\n hi\n %a= undefined\n= 12")
rescue Exception => e
- assert_match("(test_exception):3", e.backtrace[0])
+ backtrace = e.backtrace
+ backtrace.shift if rubinius?
+ assert_match("(test_exception):3", backtrace[0])
else
# Test failed... should have raised an exception
assert(false)
@@ -1272,7 +1267,7 @@ def test_exception
def test_compile_error
render("a\nb\n- fee)\nc")
rescue Exception => e
- assert_match(/\(test_compile_error\):3: syntax error/i, e.message)
+ assert_match(/\(test_compile_error\):3: (syntax error|expecting \$end)/i, e.message)
else
assert(false,
'"a\nb\n- fee)\nc" doesn\'t produce an exception!')
View
4 test/helper_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/test_helper'
+require 'test_helper'
class ActionView::Base
def nested_tag
@@ -167,7 +167,7 @@ def test_capture_haml
- (foo = capture_haml(13) do |a|
%p= a
- end; nil)
-= foo.dump
+= foo.inspect
HAML
end
View
4 test/html2haml_test.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/test_helper'
-require File.dirname(__FILE__) + '/html2haml/erb_tests'
+require 'test_helper'
+require 'html2haml/erb_tests'
require 'haml/html'
class Html2HamlTest < MiniTest::Unit::TestCase
View
2  test/results/silent_script.xhtml
@@ -50,7 +50,7 @@
<li>z</li>
</ul>
<h1>I can catch errors!</h1>
- Oh no! "undefined method `silly' for String:Class" happened!
+ Oh no! "foo" happened!
<p>
"false" is:
false
View
4 test/template_test.rb
@@ -1,6 +1,6 @@
-require File.dirname(__FILE__) + '/test_helper'
+require 'test_helper'
require 'sass/plugin'
-require File.dirname(__FILE__) + '/mocks/article'
+require 'mocks/article'
require 'action_pack/version'
View
4 test/templates/silent_script.haml
@@ -8,8 +8,8 @@
%li= i
%h1 I can catch errors!
- begin
- - String.silly
- - rescue NameError => e
+ - raise "foo"
+ - rescue RuntimeError => e
= "Oh no! \"#{e}\" happened!"
%p
"false" is:
View
4 test/test_helper.rb
@@ -1,6 +1,6 @@
require 'rubygems'
require 'bundler/setup'
-require "test/unit" # On JRuby, tests won't run unless we include this WTF
+require 'test/unit' # On JRuby, tests won't run unless we include this. WTF?
require 'minitest/autorun'
require 'action_pack'
require 'action_controller'
@@ -23,8 +23,8 @@ class TestApp < Rails::Application
require 'fileutils'
require 'haml'
-
require 'haml/template'
+
Haml::Template.options[:ugly] = false
Haml::Template.options[:format] = :xhtml
View
3  test/util_test.rb
@@ -1,5 +1,4 @@
-require File.dirname(__FILE__) + '/test_helper'
-require 'pathname'
+require 'test_helper'
class UtilTest < MiniTest::Unit::TestCase
include Haml::Util

No commit comments for this range

Something went wrong with that request. Please try again.