| 1 | #!/usr/bin/env python2
 | 
| 2 | """
 | 
| 3 | u2.py
 | 
| 4 | """
 | 
| 5 | from __future__ import print_function
 | 
| 6 | 
 | 
| 7 | import sys
 | 
| 8 | 
 | 
| 9 | 
 | 
| 10 | from core import completion
 | 
| 11 | from core import test_lib
 | 
| 12 | from frontend import parse_lib
 | 
| 13 | from osh import state
 | 
| 14 | 
 | 
| 15 | 
 | 
| 16 | def main(argv):
 | 
| 17 |   init_code = ' echo hi >&2 '
 | 
| 18 | 
 | 
| 19 |   arena = test_lib.MakeArena('<InitCompletionTest>')
 | 
| 20 |   parse_ctx = parse_lib.ParseContext(arena, {})
 | 
| 21 |   mem = state.Mem('', [], {}, arena)
 | 
| 22 | 
 | 
| 23 |   comp_lookup = completion.Lookup()
 | 
| 24 |   ex = test_lib.EvalCode(init_code, parse_ctx, comp_lookup=comp_lookup,
 | 
| 25 |                          mem=mem)
 | 
| 26 | 
 | 
| 27 |   print('hi')
 | 
| 28 | 
 | 
| 29 | 
 | 
| 30 | if __name__ == '__main__':
 | 
| 31 |   try:
 | 
| 32 |     main(sys.argv)
 | 
| 33 |   except RuntimeError as e:
 | 
| 34 |     print('FATAL: %s' % e, file=sys.stderr)
 | 
| 35 |     sys.exit(1)
 | 
| 36 | 
 |