Simplify tests for JS and python.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user