Sha256: 7deb199319c98866c4c508be57e44cc9be142370dac57885140ff37e4f45d93d

Contents?: true

Size: 1007 Bytes

Versions: 22

Compression:

Stored size: 1007 Bytes

Contents

require "babelyoda/strings_lexer"

describe "strings lexer" do
  it "can be created" do
    lexer = Babelyoda::StringsLexer.new
  end
  
  context "basic strings lexer" do

    before(:each) do
      @lexer = Babelyoda::StringsLexer.new
    end

    it "can parse tokens" do
      str = <<-EOF
      /* Some comment */
      "Some key" = "Some translation";
      EOF
      result = []
      @lexer.lex(str) do |token, value|
        result << { :token => token, :value => value }
      end
      result.size.should == 5
      result[0][:token].should == :multiline_comment
      result[0][:value].should == "/* Some comment */"
      result[1][:token].should == :string
      result[1][:value].should == "\"Some key\""
      result[2][:token].should == :equal_sign
      result[2][:value].should == "="
      result[3][:token].should == :string
      result[3][:value].should == "\"Some translation\""
      result[4][:token].should == :semicolon
      result[4][:value].should == ";"
    end

  end  
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
babelyoda-2.2.0 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.20 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.19 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.18 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.17 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.16 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.15 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.14 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.13 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.12 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.11 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.10 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.9 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.8 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.7 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.6 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.5 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.4 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.3 spec/lib/babelyoda/strings_lexer_spec.rb
babelyoda-2.1.2 spec/lib/babelyoda/strings_lexer_spec.rb