Sha256: a94f6203b1c8ded98ea1563945c816bd99920d6575f5bc7f67b90739b575a73c

Contents?: true

Size: 1.62 KB

Versions: 18

Compression:

Stored size: 1.62 KB

Contents

#encoding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

module Gherkin
  module Lexer
    shared_examples_for "a Gherkin lexer lexing tags" do
      it "should lex a single tag" do
        @listener.should_receive(:tag).with("dog", 1)
        @lexer.scan("@dog\n")
      end
  
      it "should lex multiple tags" do
        @listener.should_receive(:tag).twice
        @lexer.scan("@dog @cat\n")
      end
  
      it "should lex UTF-8 tags" do
        @listener.should_receive(:tag).with("シナリオテンプレート", 1)
        @lexer.scan("@シナリオテンプレート\n")
      end
        
      it "should lex mixed tags" do
        @listener.should_receive(:tag).with("wip", 1).ordered
        @listener.should_receive(:tag).with("Значения", 1).ordered
        @lexer.scan("@wip @Значения\n")
      end
  
      it "should lex wacky identifiers" do
        @listener.should_receive(:tag).exactly(4).times
        @lexer.scan("@BJ-x98.77 @BJ-z12.33 @O_o" "@#not_a_comment\n")
      end

      # TODO: Ask on ML for opinions about this one
      it "should lex tags without spaces between them?" do
        @listener.should_receive(:tag).twice
        @lexer.scan("@one@two\n")
      end
    
      it "should not lex tags beginning with two @@ signs" do
        @listener.should_not_receive(:tag)
        lambda { @lexer.scan("@@test\n") }.should raise_error(/Lexing error on line 1/)
      end
    
      it "should not lex a lone @ sign" do
        @listener.should_not_receive(:tag)
        lambda { @lexer.scan("@\n") }.should raise_error(/Lexing error on line 1/)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gherkin-1.0.2-i386-mswin32 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.2-i386-mingw32 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.2-java spec/gherkin/shared/tags_spec.rb
gherkin-1.0.2 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.1-i386-mswin32 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.1-i386-mingw32 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.1-universal-java-1.5 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.1 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.0-i386-mingw32 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.0-i386-mswin32 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.0-universal-java-1.5 spec/gherkin/shared/tags_spec.rb
gherkin-1.0.0 spec/gherkin/shared/tags_spec.rb
gherkin-0.0.4-universal-java-1.5 spec/gherkin/shared/tags_spec.rb
gherkin-0.0.4-i386-mswin32 spec/gherkin/shared/tags_spec.rb
gherkin-0.0.4-i386-mingw32 spec/gherkin/shared/tags_spec.rb
gherkin-0.0.4 spec/gherkin/shared/tags_spec.rb
gherkin-0.0.3-universal-java-1.5 spec/gherkin/shared/tags_spec.rb
gherkin-0.0.3 spec/gherkin/shared/tags_spec.rb