-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMayHappyTest.java
More file actions
34 lines (30 loc) · 838 Bytes
/
Copy pathMayHappyTest.java
File metadata and controls
34 lines (30 loc) · 838 Bytes
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
import junit.framework.TestCase;
import set.*;
import visitor.*;
import syntaxtree.*;
public class MayHappyTest extends TestCase {
MiniX10Parser _parser;
public File Parse(String file) {
try {
java.io.InputStream stream = new java.io.FileInputStream(file);
_parser = new MiniX10Parser(stream);
File f = _parser.File();
return f;
}
catch (Exception e) {
System.err.println(e);
return null;
}
}
public void testMethodFindVisitor() {
File f = Parse("examples/MapReduce.x10");
MethodFindVisitor v = new MethodFindVisitor();
MethodDeclaration method = v.find(f, "map");
assertEquals(method != null, true);
TextVisitor t = new TextVisitor();
t.visit(method.f2);
assertEquals(t.getText(), "map");
method = v.find(f, "foobar");
assertEquals(method == null, true);
}
}