예제 #1
0
 @Test
 public void testSuperClass() throws IOException, beaver.Parser.Exception {
   Program program = new MJFile("tests/junit/name_superclass.java").parse();
   ClassDecl blubb = program.getDecls(1);
   ClassDecl muh = blubb.superClass();
   assertNotNull(muh);
   assertEquals("Muh", muh.getIdent());
 }
예제 #2
0
 @Test
 public void testVarDecl() throws IOException, beaver.Parser.Exception {
   Program program = new MJFile("tests/junit/name_vardecl.java").parse();
   Assign assign = (Assign) program.getMain().getStmts(0);
   TypedVar decl = assign.decl();
   assertNotNull(decl);
   assertEquals("b", decl.getIdent());
 }
예제 #3
0
 @Test
 public void testClassDecl() throws IOException, beaver.Parser.Exception {
   Program program = new MJFile("tests/junit/name_classdecl.java").parse();
   Assign assign = (Assign) program.getMain().getStmts(0);
   ObjAlloc alloc = (ObjAlloc) assign.getRhs();
   ClassDecl blubb = alloc.decl();
   assertNotNull(blubb);
   assertEquals("Blubb", blubb.getIdent());
 }
예제 #4
0
 @Test
 public void testDuplicatNameClass() throws IOException, Exception {
   Program p = new MJFile("tests/junit/name_duplicatNameClass.java").parse();
   assertEquals(1, p.errors().size());
 }