Package gherkin.lexer

Examples of gherkin.lexer.Lexer


        machinePath = "/gherkin/parser/" + name + ".txt";
    }

    public List<List<String>> transitionTable() {
        transitionTable = new ArrayList<List<String>>();
        Lexer lexer = new En(this);
        lexer.scan(FixJava.readResource(machinePath));
        return transitionTable;
    }
View Full Code Here


public class I18nLexerTest {
    @Test
    public void shouldScanMultiLineFeature() {
        Listener listener = mock(Listener.class);
        Lexer lexer = new I18nLexer(listener);

        String feature = "" +
                " Feature: Hello\n" +
                "     Big    \n" +
                "       World  \n" +
                "  Scenario Outline:\n" +
                "    Given I have an empty stack\n" +
                "    When I pøsh <x> onto the stack";

        lexer.scan(feature);

        verify(listener).feature("Feature", "Hello", "  Big    \n    World", 1);
        verify(listener).step("Given ", "I have an empty stack", 5);
        verify(listener).step("When ", "I pøsh <x> onto the stack", 6);
    }
View Full Code Here

    }

    @Test
    public void shouldScanUtf8FeatureInSourceProperly() {
        Listener listener = mock(Listener.class);
        Lexer lexer = new I18nLexer(listener);

        String feature = "Feature: ÆØÅ\n" +
                "\n" +
                "  Scenario Outline:\n" +
                "    Given I have an empty stack\n" +
                "    When I pøsh <x> onto the stack";

        lexer.scan(feature);

        verify(listener).feature("Feature", "ÆØÅ", "", 1);
        verify(listener).step("When ", "I pøsh <x> onto the stack", 5);
    }
View Full Code Here

    }

    @Test
    public void shouldScanUtf8FeatureInFileProperly() throws UnsupportedEncodingException {
        Listener listener = mock(Listener.class);
        Lexer lexer = new I18nLexer(listener);

        String feature = FixJava.readResource("/gherkin/utf8.feature");

        lexer.scan(feature);

        verify(listener).feature("Feature", "ÆØÅ", "", 1);
        verify(listener).step("When ", "I pøsh <x> onto the stack", 5);
    }
View Full Code Here

    }

    @Test
    public void shouldScanStepWithEmptyName() {
        Listener listener = mock(Listener.class);
        Lexer lexer = new I18nLexer(listener);

        String feature = "" +
                "Feature: F\n" +
                "  Scenario: S\n" +
                "    Given ";

        lexer.scan(feature);

        verify(listener).feature("Feature", "F", "", 1);
        verify(listener).scenario("Scenario", "S", "", 2);
        verify(listener).step("Given ", "", 3);
    }
View Full Code Here

TOP

Related Classes of gherkin.lexer.Lexer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.