summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-03-26 04:43:17 +0000
committermurphy <murphy@rubychan.de>2010-03-26 04:43:17 +0000
commit7099489b0bd988e26916afc55c3b1f2874c3ea09 (patch)
tree250444d002a2dcfe3f5d48e1572d6fdeac5c4d08
parent1c1a3d50b1605b45d829519fb8e4502109a11448 (diff)
downloadcoderay-7099489b0bd988e26916afc55c3b1f2874c3ea09.tar.gz
Improved functional tests.
-rwxr-xr-xtest/functional/basic.rb15
-rw-r--r--test/functional/vhdl.rb2
2 files changed, 14 insertions, 3 deletions
diff --git a/test/functional/basic.rb b/test/functional/basic.rb
index 6eb9782..9f68763 100755
--- a/test/functional/basic.rb
+++ b/test/functional/basic.rb
@@ -11,15 +11,26 @@ class BasicTest < Test::Unit::TestCase
RUBY_TEST_CODE = 'puts "Hello, World!"'
+ RUBY_TEST_TOKENS = [
+ ['puts', :ident],
+ [' ', :space],
+ [:open, :string],
+ ['"', :delimiter],
+ ['Hello, World!', :content],
+ ['"', :delimiter],
+ [:close, :string]
+ ]
def test_simple_scan
assert_nothing_raised do
- CodeRay.scan(RUBY_TEST_CODE, :ruby)
+ assert_equal RUBY_TEST_TOKENS, CodeRay.scan(RUBY_TEST_CODE, :ruby).to_ary
end
end
+ RUBY_TEST_HTML = 'puts <span class="s"><span class="dl">&quot;</span>' +
+ '<span class="k">Hello, World!</span><span class="dl">&quot;</span></span>'
def test_simple_highlight
assert_nothing_raised do
- CodeRay.scan(RUBY_TEST_CODE, :ruby).html
+ assert_equal RUBY_TEST_HTML, CodeRay.scan(RUBY_TEST_CODE, :ruby).html
end
end
diff --git a/test/functional/vhdl.rb b/test/functional/vhdl.rb
index c7e3824..3b8262b 100644
--- a/test/functional/vhdl.rb
+++ b/test/functional/vhdl.rb
@@ -106,7 +106,7 @@ class VHDL < CodeRay::Scanners::Scanner
end
match ||= matched
- if $DEBUG and not kind
+ if $CODERAY_DEBUG and not kind
raise_inspect 'Error token %p in line %d' %
[[match, kind], line], tokens
end