parent
992e96ce79
commit
52f7e3a5ab
|
@ -3758,94 +3758,4 @@ void function(int i, int p)
|
|||
{
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the handling of comments
|
||||
*/
|
||||
unittest
|
||||
{
|
||||
import tlang.compiler.lexer.kinds.arr : ArrLexer;
|
||||
|
||||
try
|
||||
{
|
||||
string sourceCode = `module myCommentModule;
|
||||
// Hello`;
|
||||
|
||||
File dummyFile;
|
||||
Compiler compiler = new Compiler(sourceCode, "legitidk.t", dummyFile);
|
||||
|
||||
compiler.doLex();
|
||||
compiler.doParse();
|
||||
|
||||
// FIXME: Re-enable when we we have
|
||||
// a way to extract comments from
|
||||
// AST nodes
|
||||
// assert(parser.hasCommentsOnStack());
|
||||
// assert(parser.getCommentCount() == 1);
|
||||
}
|
||||
catch(TError e)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
string sourceCode = `module myCommntedModule;
|
||||
/*Hello */
|
||||
|
||||
/* Hello*/`;
|
||||
|
||||
File dummyFile;
|
||||
Compiler compiler = new Compiler(sourceCode, "legitidk.t", dummyFile);
|
||||
|
||||
compiler.doLex();
|
||||
compiler.doParse();
|
||||
|
||||
// FIXME: Re-enable when we we have
|
||||
// a way to extract comments from
|
||||
// AST nodes
|
||||
// assert(parser.hasCommentsOnStack());
|
||||
// assert(parser.getCommentCount() == 1);
|
||||
}
|
||||
catch(TError e)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
string sourceCode = `module myCommentedModule;
|
||||
|
||||
void function()
|
||||
{
|
||||
/*Hello */
|
||||
/* Hello */
|
||||
// Hello
|
||||
//Hello
|
||||
}
|
||||
`;
|
||||
|
||||
File dummyFile;
|
||||
Compiler compiler = new Compiler(sourceCode, "legitidk.t", dummyFile);
|
||||
|
||||
compiler.doLex();
|
||||
compiler.doParse();
|
||||
|
||||
|
||||
// FIXME: Re-enable when we we have
|
||||
// a way to extract comments from
|
||||
// AST nodes
|
||||
// assert(parser.hasCommentsOnStack());
|
||||
// assert(parser.getCommentCount() == 1);
|
||||
// assert(parser.hasCommentsOnStack());
|
||||
// assert(parser.getCommentCount() == 4);
|
||||
}
|
||||
catch(TError e)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue