1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
require 'test/unit' require 'coderay' class CountTest < Test::Unit::TestCase def test_count tokens = CodeRay.scan <<-RUBY.strip, :ruby #!/usr/bin/env ruby # a minimal Ruby program puts "Hello world!" RUBY assert_equal 11, tokens.encode(:count) end end