Sha256: f51aa069227a9d7e2dc641361e1e6a7b7f945cb58441726ab23c461e52683a88

Contents?: true

Size: 707 Bytes

Versions: 18

Compression:

Stored size: 707 Bytes

Contents

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rdoc-3.9.5 test/test_rdoc_ruby_lex.rb
rdoc-3.9.4 test/test_rdoc_ruby_lex.rb
rdoc-3.9.3 test/test_rdoc_ruby_lex.rb
rdoc-3.9.2 test/test_rdoc_ruby_lex.rb
rdoc-3.9.1 test/test_rdoc_ruby_lex.rb
rdoc-3.9 test/test_rdoc_ruby_lex.rb
rdoc-3.8 test/test_rdoc_ruby_lex.rb
rdoc-3.7 test/test_rdoc_ruby_lex.rb
rdoc-3.6.1 test/test_rdoc_ruby_lex.rb
rdoc-3.6 test/test_rdoc_ruby_lex.rb
rdoc-3.5.3 test/test_rdoc_ruby_lex.rb
rdoc-3.5.2 test/test_rdoc_ruby_lex.rb
rdoc-3.5.1 test/test_rdoc_ruby_lex.rb
rdoc-3.5 test/test_rdoc_ruby_lex.rb
rdoc-3.4 test/test_rdoc_ruby_lex.rb
rdoc-3.3 test/test_rdoc_ruby_lex.rb
rdoc-3.2 test/test_rdoc_ruby_lex.rb
rdoc-3.1 test/test_rdoc_ruby_lex.rb