Mercurial > projects > dil
changeset 40:9d5ceb0f8be9
- Added more tokens for testing.
author | aziz |
---|---|
date | Tue, 26 Jun 2007 10:20:00 +0000 |
parents | 69b940398d7b |
children | 2b7be1d67d4d |
files | trunk/src/Lexer.d |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/Lexer.d Tue Jun 26 10:06:01 2007 +0000 +++ b/trunk/src/Lexer.d Tue Jun 26 10:20:00 2007 +0000 @@ -945,11 +945,18 @@ unittest { - string[] ops = [">", ">=", ">>", ">>=", ">>>", ">>>=", "<", "<=", "<>", "<>=", "<<", "<<=", "!", "!<", "!>", "!<=", "!>=", "!<>", "!<>=", ".", "..", "...", "&", "&&", "&=", "+", "++", "+=", "-", "--", "-=", "=", "==", "~", "~=", "*", "*=", "^", "^=", "%", "%="]; + string[] toks = [ + ">", ">=", ">>", ">>=", ">>>", ">>>=", "<", "<=", "<>", + "<>=", "<<", "<<=", "!", "!<", "!>", "!<=", "!>=", "!<>", + "!<>=", ".", "..", "...", "&", "&&", "&=", "+", "++", + "+=", "-", "--", "-=", "=", "==", "~", "~=", "*", + "*=", "/", "/=", "^", "^=", "%", "%=", "(", ")", + "[", "]", "{", "}", ":", ";", "?", ",", "$" + ]; char[] src; - foreach (op; ops) + foreach (op; toks) src ~= op ~ " "; auto lx = new Lexer(src, ""); @@ -957,8 +964,8 @@ tokens = tokens[0..$-1]; // exclude TOK.EOF - assert(tokens.length == 41 ); + assert(tokens.length == toks.length ); foreach (i, t; tokens) - assert(t.span == ops[i], std.string.format("Lexed '%s' but expected '%s'", t.span, ops[i])); + assert(t.span == toks[i], std.string.format("Lexed '%s' but expected '%s'", t.span, toks[i])); } \ No newline at end of file