blob: 5b1249b24b968e19b338dcb35e35cc0183a9ff2f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*******************************************************************************
* Copyright (c) 2006, 2018 IBM Corporation and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
*******************************************************************************/
package org.eclipse.linuxtools.systemtap.ui.ide.test.structures;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.StapErrorParser;
import org.junit.Test;
public class StapErrorParserTest {
@Test
public void testStapErrorParser() {
String[][] output;
StapErrorParser parser = new StapErrorParser();
output = parser.parseOutput(null);
assertNull(output);
output = parser.parseOutput("");
assertNotNull(output);
assertEquals(0, output.length);
output = parser.parseOutput("this shouldn't have anything");
assertNotNull(output);
assertEquals(0, output.length);
output = parser.parseOutput("parse error: expected identifier or '*' \n" +
"saw: operator '{' at /home/morser/test.stp:14:7 \n" +
"1 parse error(s). \n" +
"Pass 1: parse failed. Try again with more '-v' (verbose) options.");
assertNotNull(output);
assertEquals(1, output.length);
assertTrue("parse error:".equals(output[0][0]));
assertTrue(output[0][3].startsWith("14"));
output = parser.parseOutput("semantic error: probe_615 with type mismatch for identifier 'flags' at /home/morser/test.stp:22:6: string vs. long \n" +
"semantic error: probe_615 with type mismatch for identifier 'mode' at /home/morser/test.stp:23:6: string vs. long \n" +
"semantic error: probe_615 with type mismatch for identifier 'f' at /home/morser/test.stp:25:6: string vs. long \n" +
"Pass 2: analysis failed. Try again with more '-v' (verbose) options.");
assertNotNull(output);
assertEquals(3, output.length);
assertTrue("semantic error:".equals(output[0][0]));
assertTrue(output[0][3].startsWith("22:6"));
}
}
|