diff options
Diffstat (limited to 'test/rdoc/test_rdoc_ruby_lex.rb')
-rw-r--r-- | test/rdoc/test_rdoc_ruby_lex.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_ruby_lex.rb b/test/rdoc/test_rdoc_ruby_lex.rb new file mode 100644 index 0000000000..4398f4119f --- /dev/null +++ b/test/rdoc/test_rdoc_ruby_lex.rb @@ -0,0 +1,23 @@ +require 'rubygems' +require 'minitest/autorun' +require 'rdoc/rdoc' +require 'rdoc/ruby_lex' + +class TestRubyLex < MiniTest::Unit::TestCase + def test_unary_minus + ruby_lex = RDoc::RubyLex.new("-1", nil) + assert_equal("-1", ruby_lex.token.value) + + ruby_lex = RDoc::RubyLex.new("a[-2]", nil) + 2.times { ruby_lex.token } # skip "a" and "[" + assert_equal("-2", ruby_lex.token.value) + + ruby_lex = RDoc::RubyLex.new("a[0..-12]", nil) + 4.times { ruby_lex.token } # skip "a", "[", "0", and ".." + assert_equal("-12", ruby_lex.token.value) + + ruby_lex = RDoc::RubyLex.new("0+-0.1", nil) + 2.times { ruby_lex.token } # skip "0" and "+" + assert_equal("-0.1", ruby_lex.token.value) + end +end |