summaryrefslogtreecommitdiff
path: root/test/unit/lines_of_code.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2011-09-18 22:24:06 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2011-09-18 22:24:06 +0200
commita6b256219d84022fc518d620b210754b5f8ccce4 (patch)
tree0e99a1016c548e5bba3ffeea0ff327bbde42af76 /test/unit/lines_of_code.rb
parent13e31231833ac7236b90a9680fef334c2ed6136d (diff)
downloadcoderay-a6b256219d84022fc518d620b210754b5f8ccce4.tar.gz
#352 CodeRay.scan returns TokensProxy
Diffstat (limited to 'test/unit/lines_of_code.rb')
-rw-r--r--test/unit/lines_of_code.rb13
1 files changed, 3 insertions, 10 deletions
diff --git a/test/unit/lines_of_code.rb b/test/unit/lines_of_code.rb
index 4231d5a..e2c0caf 100644
--- a/test/unit/lines_of_code.rb
+++ b/test/unit/lines_of_code.rb
@@ -2,6 +2,8 @@ require 'test/unit'
require 'coderay'
$VERBOSE = true
+require File.expand_path('../../lib/assert_warning', __FILE__)
+
class LinesOfCodeTest < Test::Unit::TestCase
def test_creation
@@ -39,17 +41,8 @@ puts "Hello world!"
tokens.concat ["\n", :space]
tokens.concat ["Hello\n", :comment]
- stderr, fake_stderr = $stderr, Object.new
- begin
- $err = ''
- def fake_stderr.write x
- $err << x
- end
- $stderr = fake_stderr
+ assert_warning 'Tokens have no associated scanner, counting all nonempty lines.' do
assert_equal 1, tokens.lines_of_code
- assert_equal "Tokens have no associated scanner, counting all nonempty lines.\n", $err
- ensure
- $stderr = stderr
end
tokens.scanner = ScannerMockup.new