Simplify tests for JS and python.

This commit is contained in:
Joshua Bemenderfer
2023-02-14 22:33:16 -05:00
parent 4156e3bf91
commit c28fe448be
2 changed files with 30 additions and 47 deletions

View File

@@ -13,8 +13,8 @@ def next():
# return None if there actually is no result.
return line.rstrip('\n') if len(line) > 0 else None
def linedata_basic ():
lineData = createLineData('')
def linedata_basic (indent):
lineData = createLineData('', indent)
while (l := next()) != None:
lineData['line'] = l
@@ -46,18 +46,12 @@ def linedata_head_tail ():
head = head, tail = tail
))
tests = {
'linedata:basic': linedata_basic,
'linedata:tabs': linedata_tabs,
'linedata:head-tail': linedata_head_tail
}
def main():
testName = sys.argv[1]
test = tests[testName]
test()
if testName == 'linedata:basic': linedata_basic(' ')
if testName == 'linedata:tabs': linedata_basic('\t')
if testName == 'linedata:head-tail': linedata_head_tail()
if __name__ == "__main__":
main()