Package com.github.jknack.antlr4ide.lang

Examples of com.github.jknack.antlr4ide.lang.GrammarAction


  @Test
  public void actionOnDiffScopesMustNotFail() throws Exception {
    EList<PrequelConstruct> prequels = new BasicEList<PrequelConstruct>();

    Grammar grammar = createMock(Grammar.class);
    GrammarAction action1 = createMock(GrammarAction.class);
    GrammarAction action2 = createMock(GrammarAction.class);
    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    expect(grammar.getPrequels()).andReturn(prequels);

    expect(action1.getScope()).andReturn("lexer");
    expect(action1.getName()).andReturn("header");

    expect(action2.getScope()).andReturn("parser");
    expect(action2.getName()).andReturn("header");

    prequels.add(action1);
    prequels.add(action2);

    Object[] mocks = {grammar, validator, action1, action2 };
View Full Code Here


  @Test
  public void checkActionRedefinition() throws Exception {
    EList<PrequelConstruct> prequels = new BasicEList<PrequelConstruct>();

    Grammar grammar = createMock(Grammar.class);
    GrammarAction action1 = createMock(GrammarAction.class);
    GrammarAction action2 = createMock(GrammarAction.class);
    EClass eClass = createMock(EClass.class);
    EStructuralFeature feature = createMock(EStructuralFeature.class);
    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    expect(grammar.getPrequels()).andReturn(prequels);

    expect(action1.getScope()).andReturn(null);
    expect(action1.getName()).andReturn("members");

    expect(action2.getScope()).andReturn(null);
    expect(action2.getName()).andReturn("members");
    expect(action2.eClass()).andReturn(eClass);
    expect(eClass.getEStructuralFeature("name")).andReturn(feature);

    PowerMock.expectPrivate(validator, "error", "redefinition of 'members' action",
        action2, feature);
View Full Code Here

TOP

Related Classes of com.github.jknack.antlr4ide.lang.GrammarAction

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.