Sha256: 8d7b9ef4cbde91376e80b2d1f9a35a887fd6c734a3720f6704ef147229e04cf6
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
require 'test_helper' module LucidTDL describe Parser do before do @lexer = Parser.new end it "will ignore commented lines" do @lexer.tokenize("# Commented line").must_equal [] end it "can parse a single newline character" do @lexer.tokenize("\n").must_equal [[:NEWLINE, "\n"]] end it "can parse multiple newline characters" do @lexer.tokenize("\n\n").must_equal [[:NEWLINE, "\n"], [:NEWLINE, "\n"]] end it "can parse text strings" do @lexer.tokenize("simple text").must_equal [[:TEXT, "simple text"]] end it "strip parsed text strings" do @lexer.tokenize(" simple text ").must_equal [[:TEXT, "simple text"]] end it "parses a single tag" do @lexer.tokenize("@selenium @headless").must_equal [ [:TAG, "selenium"], [:TAG, "headless"], ] end it "parses multiple tags" do end describe "high-level structural keywords" do %w(Feature: Ability: Responsibility:).each do |keyword| it "parses #{keyword}:" do name = keyword[0..-2] @lexer.tokenize(keyword).must_equal [[name.upcase.to_sym, name]] end end end describe "operational structural keywords" do %w(Background: Scenario: Test:).each do |keyword| it "parses #{keyword}:" do name = keyword[0..-2] @lexer.tokenize(keyword).must_equal [[name.upcase.to_sym, name]] end end end describe "specific step keywords" do %w(Given When Then And But).each do |keyword| it "parses #{keyword}" do @lexer.tokenize(keyword).must_equal [[keyword.upcase.to_sym, keyword]] end end end describe "generic step keywords" do %w(*).each do |keyword| it "parses #{keyword}" do @lexer.tokenize(keyword).must_equal [[:GENERIC, "*"]] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lucid-tdl-1.1.0 | test/lucid-tdl/parser/lexer_test.rb |