1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Merge branch 'stable' of git@github.com:nex3/haml into stable

Conflicts:
	Rakefile
This commit is contained in:
Nathan Weizenbaum 2009-10-04 17:41:12 -07:00
commit f49cdd3b3e
8 changed files with 27 additions and 13 deletions

View file

@ -25,6 +25,7 @@ Rake::TestTask.new do |t|
t.libs << 'lib'
test_files = FileList['test/**/*_test.rb']
test_files.exclude('test/rails/*')
test_files.exclude('test/haml/spec/*')
t.test_files = test_files
t.verbose = true
end
@ -163,7 +164,7 @@ def mode_unchanged?(mode, version)
mode_version = File.read("extra/#{mode}-mode.el").scan(/^;; Version: (.*)$/).first.first
return false if mode_version == version
return mode_version unless changed_since?(mode_version, "extra/#{mode}-mode.el")
raise "#{mode}-mode.el version is #{haml_mode_version.inspect}, but it has changed as of #{version.inspect}"
raise "#{mode}-mode.el version is #{version.inspect}, but it has changed as of #{version.inspect}"
return false
end

View file

@ -1 +1 @@
2.2.5
2.2.6

View file

@ -3,7 +3,7 @@
* Table of contents
{:toc}
## 2.2.6 (Unreleased)
## [2.2.6](http://github.com/nex3/haml/commit/2.2.6)
* Made the error message when unable to load a dependency for html2haml
respect the `--trace` option.
@ -14,6 +14,9 @@
* Add "Sass" to the `--version` string for the executables.
* Raise an exception when commas are omitted in static attributes
(e.g. `%p{:foo => "bar" :baz => "bang"}`).
## [2.2.5](http://github.com/nex3/haml/commit/2.2.5)
* Got rid of trailing whitespace produced when opening a conditional comment

View file

@ -3,7 +3,7 @@
* Table of contents
{:toc}
## 2.2.6 (Unreleased)
## [2.2.6](http://github.com/nex3/haml/commit/2.2.6)
* Don't crash when the `__FILE__` constant of a Ruby file is a relative path,
as apparently happens sometimes in TextMate

View file

@ -4,7 +4,7 @@
;; Author: Nathan Weizenbaum
;; URL: http://github.com/nex3/haml/tree/master
;; Version: 2.2.5
;; Version: 2.2.6
;; Created: 2007-03-08
;; By: Nathan Weizenbaum
;; Keywords: markup, language, html

View file

@ -4,7 +4,7 @@
;; Author: Nathan Weizenbaum
;; URL: http://github.com/nex3/haml/tree/master
;; Version: 2.2.5
;; Version: 2.2.6
;; Created: 2007-03-15
;; By: Nathan Weizenbaum
;; Keywords: markup, language, css

View file

@ -465,8 +465,8 @@ END
return unless key = scanner.scan(LITERAL_VALUE_REGEX)
return unless scanner.scan(/\s*=>\s*/)
return unless value = scanner.scan(LITERAL_VALUE_REGEX)
return unless scanner.scan(/\s*(?:,|$)\s*/)
attributes[eval(key).to_s] = eval(value).to_s
scanner.scan(/[,\s]*/)
end
text.count("\n").times { newline }
attributes

View file

@ -54,6 +54,12 @@ class EngineTest < Test::Unit::TestCase
"%p(foo 'bar')" => "Invalid attribute list: \"(foo 'bar')\".",
"%p(foo 'bar'\nbaz='bang')" => ["Invalid attribute list: \"(foo 'bar'\".", 1],
"%p(foo='bar'\nbaz 'bang'\nbip='bop')" => ["Invalid attribute list: \"(foo='bar' baz 'bang'\".", 2],
"%p{:foo => 'bar' :bar => 'baz'}" => :compile,
"%p{:foo => }" => :compile,
"%p{=> 'bar'}" => :compile,
"%p{:foo => 'bar}" => :compile,
"%p{'foo => 'bar'}" => :compile,
"%p{:foo => 'bar\"}" => :compile,
# Regression tests
"- raise 'foo'\n\n\n\nbar" => ["foo", 1],
@ -727,18 +733,22 @@ HAML
assert_equal("<a b='2' />\nc\n", render("%a{'b' => 1 + 1}/\n= 'c'\n"))
end
def test_exceptions
EXCEPTION_MAP.each do |key, value|
define_method("test_exception (#{key.inspect})") do
begin
render(key, :filename => "(exception test for #{key.inspect})")
render(key, :filename => __FILE__)
rescue Exception => err
value = [value] unless value.is_a?(Array)
expected_message, line_no = value
line_no ||= key.split("\n").length
line_reported = err.backtrace[0].gsub(/\(.+\):/, '').to_i
if expected_message == :compile
assert_match(/^compile error\n/, err.message, "Line: #{key}")
else
assert_equal(expected_message, err.message, "Line: #{key}")
assert_equal(line_no, line_reported, "Line: #{key}")
end
assert_match(/^#{Regexp.escape(__FILE__)}:#{line_no}/, err.backtrace[0], "Line: #{key}")
else
assert(false, "Exception not raised for\n#{key}")
end