Adds previous slurping as runnable testcase.
This commit is contained in:
parent
5b1caed806
commit
4c7607e074
1 changed files with 14 additions and 1 deletions
|
|
@ -45,7 +45,7 @@ const
|
||||||
"Label", "Reference", "Other"]
|
"Label", "Reference", "Other"]
|
||||||
|
|
||||||
# The following list comes from doc/keywords.txt, make sure it is
|
# The following list comes from doc/keywords.txt, make sure it is
|
||||||
# synchronized with this array.
|
# synchronized with this array by running the module itself as a test case.
|
||||||
nimrodKeywords = ["addr", "and", "as", "asm", "atomic", "bind", "block",
|
nimrodKeywords = ["addr", "and", "as", "asm", "atomic", "bind", "block",
|
||||||
"break", "case", "cast", "const", "continue", "converter", "discard",
|
"break", "case", "cast", "const", "continue", "converter", "discard",
|
||||||
"distinct", "div", "do", "elif", "else", "end", "enum", "except", "export",
|
"distinct", "div", "do", "elif", "else", "end", "enum", "except", "export",
|
||||||
|
|
@ -545,3 +545,16 @@ proc getNextToken*(g: var TGeneralTokenizer, lang: TSourceLanguage) =
|
||||||
of langC: cNextToken(g)
|
of langC: cNextToken(g)
|
||||||
of langJava: javaNextToken(g)
|
of langJava: javaNextToken(g)
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
var keywords: seq[string]
|
||||||
|
# Try to work running in both the subdir or at the root.
|
||||||
|
for filename in ["doc/keywords.txt", "../../../doc/keywords.txt"]:
|
||||||
|
except: echo filename, " not found"
|
||||||
|
let input = string(readFile(filename))
|
||||||
|
keywords = input.split()
|
||||||
|
break
|
||||||
|
doAssert (not keywords.isNil, "Couldn't read any keywords.txt file!")
|
||||||
|
doAssert keywords.len == nimrodKeywords.len, "No matching lengths"
|
||||||
|
for i in 0..keywords.len-1:
|
||||||
|
echo keywords[i], " == ", nimrodKeywords[i]
|
||||||
|
doAssert keywords[i] == nimrodKeywords[i], "Unexpected keyword"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue