2"""Run transactional direct-program update context checks under eval."""
3from pathlib import Path
9root = Path(__file__).resolve().parent.parent
10parser = argparse.ArgumentParser(description=__doc__)
11parser.add_argument('--lib', default=str(root / 'jibb-dev/lib/jibb.hoon'))
12args = parser.parse_args()
15 text = (root / 'tests/lib' / name).read_text()
16 return text[text.index('\n|%\n') + 1:]
18names = ('source', 'consumer', 'wrong-result', 'wrong-model', 'wrong-message',
19 'malformed-sample', 'three-slot-sample', 'non-main', 'unrelated-tag', 'missing-list')
20expression = ('=/ jibb .\n=/ prelude=@t prelude-text\n'
21 '=/ internal=@t internal-text\n' +
22 ''.join('=/ ' + name + '=wain (to-wain:format ' + name + '-text)\n'
24 '=/ suite\n' + body('jibb-program-update.hoon') +
25 '\n=/ negatives=(list @t)\n :~ (text:suite wrong-result)\n'
26 ' (text:suite wrong-model)\n (text:suite wrong-message)\n'
27 ' (text:suite malformed-sample)\n (text:suite three-slot-sample)\n'
28 ' (text:suite non-main)\n (text:suite unrelated-tag)\n (text:suite missing-list)\n ==\n'
29 '=/ failures=(list tape) (program-update-errors:suite prelude internal (text:suite source) (text:suite consumer) negatives)\n'
30 '^- @t\n?~ failures \'program update checks passed\'\n'
31 '(of-wain:format (turn failures crip))\n')
32with tempfile.TemporaryDirectory(prefix='jibb-program-update-') as tmp:
33 program = Path(tmp) / 'program-update.hoon'
34 program.write_text(expression)
35 command = [str(root / 'tools/hoon'), '--lib', args.lib, '--raw', '-f', str(program),
36 '--cord', 'prelude-text=' + str(root / 'jibb-dev/lib/jibb/prelude.jibb'),
37 '--cord', 'internal-text=' + str(root / 'jibb-dev/lib/jibb/internal.jibb')]
39 command += ['--cord', name + '-text=' + str(root / 'tests/type-program-update' / (name + '.txt'))]
40 result = subprocess.run(command, stdout=subprocess.PIPE)
42 sys.exit(result.returncode)
43if result.stdout != b'program update checks passed\n':
44 sys.stderr.buffer.write(result.stdout)
46print('transactional direct-program update context guards passed')
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list