Sha256: 9ac9e8ee31f8347920fee6f78a406ac24260746585d21f9ebe141699c9208785

Contents?: true

Size: 625 Bytes

Versions: 7

Compression:

Stored size: 625 Bytes

Contents

require 'helper.rb'

module BibTeX
  class LexerTest < MiniTest::Spec

    it 'correctly scans a string literal' do
      assert_equal Lexer.new.analyse(%q(@string{ x = "foo" })).symbols, [:AT,:STRING,:LBRACE,:NAME,:EQ,:STRING_LITERAL,:RBRACE,false]
    end

    it 'strips line breaks by default' do
      Lexer.new.analyse(%Q(@string{ x = "foo\nbar" })).stack[-3].must_be :==,
        [:STRING_LITERAL, 'foo bar']
    end

    it 'strips whitespace after line breaks by default' do
      Lexer.new.analyse(%Q(@string{ x = "foo\n    bar" })).stack[-3].must_be :==,
        [:STRING_LITERAL, 'foo bar']
    end
    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bibtex-ruby-2.0.10 test/bibtex/test_lexer.rb
bibtex-ruby-2.0.9 test/bibtex/test_lexer.rb
bibtex-ruby-2.0.8 test/bibtex/test_lexer.rb
bibtex-ruby-2.0.7 test/bibtex/test_lexer.rb
bibtex-ruby-2.0.6 test/bibtex/test_lexer.rb
bibtex-ruby-2.0.5 test/bibtex/test_lexer.rb
bibtex-ruby-2.0.4 test/bibtex/test_lexer.rb