1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rdoc/test_rdoc_ruby_lex.rb
drbrain e2efe8e81d Import RDoc 3.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-28 22:08:56 +00:00

23 lines
707 B
Ruby

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