8cc0c3f
From 9b34e37d7ecfa750f5185a0e16df1c131732e318 Mon Sep 17 00:00:00 2001
8cc0c3f
From: Joshua Peek <josh@joshpeek.com>
8cc0c3f
Date: Mon, 17 Feb 2014 17:30:04 -0600
8cc0c3f
Subject: [PATCH] Fix assertions
418dd8b
8cc0c3f
---
8cc0c3f
 test/test_coffee_script.rb | 18 +++++++++++-------
8cc0c3f
 1 file changed, 11 insertions(+), 7 deletions(-)
418dd8b
418dd8b
diff --git a/test/test_coffee_script.rb b/test/test_coffee_script.rb
8cc0c3f
index d43fbea..ad3c692 100644
418dd8b
--- a/test/test_coffee_script.rb
418dd8b
+++ b/test/test_coffee_script.rb
8cc0c3f
@@ -17,42 +17,46 @@
418dd8b
 
8cc0c3f
 class TestCoffeeScript < TestCase
418dd8b
   def test_compile
418dd8b
-    assert_equal "(function() {\n  puts('Hello, World!');\n}).call(this);\n",
8cc0c3f
+    assert_match "puts('Hello, World!')",
418dd8b
       CoffeeScript.compile("puts 'Hello, World!'\n")
418dd8b
   end
418dd8b
 
418dd8b
   def test_compile_with_io
418dd8b
     io = StringIO.new("puts 'Hello, World!'\n")
418dd8b
-    assert_equal "(function() {\n  puts('Hello, World!');\n}).call(this);\n",
8cc0c3f
+    assert_match "puts('Hello, World!')",
418dd8b
       CoffeeScript.compile(io)
418dd8b
   end
418dd8b
 
418dd8b
   def test_compile_with_bare_true
418dd8b
-    assert_equal "puts('Hello, World!');",
8cc0c3f
+    assert_no_match "function()",
418dd8b
       CoffeeScript.compile("puts 'Hello, World!'\n", :bare => true)
418dd8b
   end
418dd8b
 
418dd8b
   def test_compile_with_bare_false
418dd8b
-    assert_equal "(function() {\n  puts('Hello, World!');\n}).call(this);\n",
8cc0c3f
+    assert_match "function()",
418dd8b
       CoffeeScript.compile("puts 'Hello, World!'\n", :bare => false)
418dd8b
   end
418dd8b
 
418dd8b
   def test_compile_with_no_wrap_true
418dd8b
-    assert_equal "puts('Hello, World!');",
8cc0c3f
+    assert_no_match "function()",
418dd8b
       CoffeeScript.compile("puts 'Hello, World!'\n", :no_wrap => true)
418dd8b
   end
418dd8b
 
418dd8b
   def test_compile_with_no_wrap
418dd8b
-    assert_equal "(function() {\n  puts('Hello, World!');\n}).call(this);\n",
8cc0c3f
+    assert_match "function()",
418dd8b
       CoffeeScript.compile("puts 'Hello, World!'\n", :no_wrap => false)
418dd8b
   end
418dd8b
 
8cc0c3f
   def test_compilation_error
8cc0c3f
-    assert_raise CoffeeScript::CompilationError do
8cc0c3f
+    assert_raises CoffeeScript::CompilationError do
8cc0c3f
       CoffeeScript.compile("unless")
8cc0c3f
     end
8cc0c3f
   end
8cc0c3f
 
8cc0c3f
+  def assert_no_match(expected, actual)
8cc0c3f
+    assert !expected.match(actual)
8cc0c3f
+  end
8cc0c3f
+
8cc0c3f
   def assert_exception_does_not_match(pattern)
8cc0c3f
     yield
8cc0c3f
     flunk "no exception raised"
8cc0c3f
-- 
8cc0c3f
1.9.3
8cc0c3f