Parse comments and knot declarations
This commit is contained in:
@@ -1,11 +1,28 @@
|
||||
package tests;
|
||||
|
||||
import hank.Parser;
|
||||
import hank.Parser.HankAST;
|
||||
|
||||
class ParserTest extends utest.Test {
|
||||
var ast: HankAST;
|
||||
|
||||
function nextExpr() {
|
||||
var next = ast[0];
|
||||
ast.remove(next);
|
||||
return next.expr;
|
||||
}
|
||||
|
||||
function assertNextExpr(expr: ExprType) {
|
||||
HankAssert.equals(expr, nextExpr());
|
||||
}
|
||||
|
||||
|
||||
function testParseMain() {
|
||||
var parser = new Parser();
|
||||
var ast = parser.parseFile('examples/main/main.hank');
|
||||
trace (ast);
|
||||
ast = parser.parseFile('examples/main/main.hank');
|
||||
assertNextExpr(EComment(" comments in Hank start with a double-slash"));
|
||||
assertNextExpr(EComment(" Or you can split comments\nacross more than one line "));
|
||||
assertNextExpr(EComment(" Or you can use block comments inline "));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user