Skip to content
Snippets Groups Projects
Commit fd818efd authored by Dmitry E. Oboukhov's avatar Dmitry E. Oboukhov
Browse files

Add tests for print().

parent 54415be9
No related branches found
No related tags found
No related merge requests found
print("Hello, world")
---
...
box.fiber.wrap(function() print("Hello, world") end)
---
- null
...
box.fiber.sleep(0.1)
---
...
Check log line
---
- "line contains 'Hello'"
...
box.fiber.wrap(function() print("Ehllo, world") end)
---
- null
...
box.fiber.sleep(0.1)
---
...
Check log line
---
- "line doesn't contain 'Hello'"
...
box.fiber.wrap(function() print() end)
---
- null
...
box.fiber.sleep(0.1)
---
...
Check log line
---
- "line doesn't contain 'PPPPPPPP'"
...
import tarantool
import sys
import os
import re
admin('print("Hello, world")')
log = os.path.join(vardir, "tarantool.log")
f = open(log, "r")
f.seek(0, 2)
admin('box.fiber.wrap(function() print("Hello, world") end)')
admin('box.fiber.sleep(0.1)')
line = f.readline()
print("Check log line")
print("---")
if re.search('(Hello)', line).start(1) > 0:
print("""- "line contains 'Hello'" """)
print("...")
admin('box.fiber.wrap(function() print("Ehllo, world") end)')
admin('box.fiber.sleep(0.1)')
line = f.readline()
print("Check log line")
print("---")
if re.search('(Hello)', line):
print("""- "line contains 'Hello'" """)
else:
print("""- "line doesn't contain 'Hello'" """)
print("...")
admin('box.fiber.wrap(function() print() end)')
admin('box.fiber.sleep(0.1)')
line = f.readline()
print("Check log line")
print("---")
if re.search('(PPPPPPPP)', line):
print("""- "line contains 'PPPPPPPP'" """)
else:
print("""- "line doesn't contain 'PPPPPPPP'" """)
print("...")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment