Examples of SourceLine


Examples of net.sf.laja.parser.engine2.source.SourceLine

  @Test
  public void errorInLineOne() {
    StringSource stringSource = new StringSource("12345\n6789");
   
    final int index = 0;
    SourceLine sourceLine = stringSource.getSourceLine(index);
    SourceLine expectedLine = new SourceLine(1, 1, index, "12345", "^");
   
    assertEquals(expectedLine, sourceLine);
  }
View Full Code Here

Examples of net.sf.laja.parser.engine2.source.SourceLine

  @Test
  public void errorInLineTwo() {
    StringSource stringSource = new StringSource("1\r\n2345\r\n67");
   
    final int index = 4;
    SourceLine sourceLine = stringSource.getSourceLine(index);
    SourceLine expectedLine = new SourceLine(2, 2, index, "2345", " ^");
   
    assertEquals(expectedLine, sourceLine);
  }
View Full Code Here

Examples of net.sf.laja.parser.engine2.source.SourceLine

  private static String getMessage(Source source, int indexInSource, Throwable cause) {
    return cause.getMessage() + "\n" + getMessage(source, indexInSource);
  }
 
  private static String getMessage(Source source, int indexInSource) {
    SourceLine sourceLine = source.getSourceLine(indexInSource);
    return "Error in " + source.getType() + " \"" + source.getName() + "\", row " + sourceLine.getRow() +
      ", column " + sourceLine.getColumn() + ":\n" +
      sourceLine.getLine() + "\n" +
      sourceLine.getCursor() + "\n";
  }
View Full Code Here

Examples of net.sourceforge.marathon.api.SourceLine

        lastLineno = line.lineNumber;
        return CONTINUE;
    }

    private void assertSourceLine(SourceLine[] traceback, int elementNumber, String methodName, int lineNumber) {
        SourceLine line = traceback[elementNumber];
        assertEquals("traceback element filename", TestPythonScript.DEFAULT_SCRIPT_NAME, line.fileName);
        assertEquals("traceback element " + elementNumber + " linenumber", lineNumber, line.lineNumber);
        assertEquals("traceback element " + elementNumber + " function name", methodName, line.functionName);
    }
View Full Code Here

Examples of net.sourceforge.marathon.api.SourceLine

    private void trace(String event, String fileName, String methodName, int lineNo) {
        if (isRepeat(event, fileName, lineNo) || shouldIgnore(fileName))
            return;

        SourceLine line = new SourceLine(fileName, methodName, lineNo);
        if (event.equals("line"))
            lineReached(line);
        else if (event.equals("return"))
            methodReturned(line);
        else if (event.equals("call"))
View Full Code Here

Examples of net.sourceforge.marathon.api.SourceLine

    @After
    public void tearDown() throws Exception {
    }

    private SourceLine[] createTraceback(String id) {
        return new SourceLine[] { new SourceLine(id + "file1", id + "func1", 5), new SourceLine(id + "file2", id + "func2", 5),
                new SourceLine(id + "file3", id + "func3", 5), };
    }
View Full Code Here

Examples of net.sourceforge.marathon.api.SourceLine

    }

    private void assertSelectedTraceBack(String message, SourceLine[] expected, SourceLine[] selectedTraceback) {
        assertEquals(message + " size", expected.length, selectedTraceback.length);
        for (int i = 0; i < expected.length; i++) {
            SourceLine sourceLine = expected[i];
            assertEquals(message + " element " + i, sourceLine, selectedTraceback[i]);
        }
    }
View Full Code Here

Examples of net.sourceforge.marathon.api.SourceLine

public class TestMarathonAssertion {
    @Test
    public void testStackTrace() throws IOException {
        SourceLine[] traceback = new SourceLine[1];
        traceback[0] = new SourceLine("testFile.py", "testFunction", 10);
        Failure f = new Failure("stackTrace", traceback);
        MarathonAssertion assertion = new MarathonAssertion(new Failure[] { f }, "stackTrace");
        StringWriter strWriter = new StringWriter();
        PrintWriter writer = new PrintWriter(strWriter);
        assertion.printStackTrace(writer);
View Full Code Here

Examples of net.sourceforge.marathon.api.SourceLine

            public void run() {
                if (!isPlaybackFinishedCalled) {
                    if (!exitIsNotAnError)
                        MarathonPlayer.this.result.addFailure(
                                "Application under test aborted - use set_no_fail_on_exit to suppress this error",
                                new SourceLine[] { new SourceLine("internal", "System.exit", 1) });
                    MarathonPlayer.this.playbackFinished(MarathonPlayer.this.result, true);
                }
            }
        });
    }
View Full Code Here

Examples of net.sourceforge.marathon.api.SourceLine

        aboutToExecute("foo", fileName, 1);
        assertEquals(0, editor.getCaretLine());
    }

    private void aboutToExecute(String methodname, String filename, int lineno) {
        display.lineReached(new SourceLine(filename, methodname, lineno));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.