adding splats as arguments to function calls

This commit is contained in:
Jeremy Ashkenas
2009-12-31 19:52:13 -05:00
parent abfc9f5a2d
commit 409283a30f
5 changed files with 90 additions and 27 deletions

View File

@@ -2,30 +2,35 @@ require 'test_helper'
class ExecutionTest < Test::Unit::TestCase
NO_WARNINGS = /\A(0 error\(s\), 0 warning\(s\)\n)+\Z/
ALLS_WELL = /\A\n?(true\n)+\Z/m
NO_WARNINGS = "0 error(s), 0 warning(s)"
# This is by far the most important test. It evaluates all of the
# CoffeeScript in test/fixtures/execution, ensuring that all our
# syntax actually works.
def test_execution_of_coffeescript
sources = ['test/fixtures/execution/*.coffee'].join(' ')
assert `bin/coffee -r #{sources}`.match(ALLS_WELL)
(`bin/coffee -r #{sources}`).split("\n").each do |line|
assert line == "true"
end
end
def test_lintless_coffeescript
lint_results = `bin/coffee -l test/fixtures/execution/*.coffee`
assert lint_results.match(NO_WARNINGS)
no_warnings `bin/coffee -l test/fixtures/execution/*.coffee`
end
def test_lintless_examples
lint_results = `bin/coffee -l examples/*.coffee`
assert lint_results.match(NO_WARNINGS)
no_warnings `bin/coffee -l examples/*.coffee`
end
def test_lintless_documentation
lint_results = `bin/coffee -l documentation/coffee/*.coffee`
assert lint_results.match(NO_WARNINGS)
no_warnings `bin/coffee -l documentation/coffee/*.coffee`
end
private
def no_warnings(output)
output.split("\n").each {|line| assert line == NO_WARNINGS }
end
end