2"""Compare the mark/checker bridge fixture under urbit eval."""
4from pathlib import Path
10root = Path(__file__).resolve().parent.parent
11fixture = root / 'tests' / 'type-mark'
12tests = (root / 'tests/lib/jibb-mark-bridge.hoon').read_text()
13tests = tests[tests.index('\n|%\n') + 1:]
14expression = ('=/ jibb .\n' +
15 ''.join('=/ ' + n + '=wain (to-wain:format ' + n + '-text)\n'
16 for n in ('declared', 'missing', 'sur', 'collision', 'expected')) +
17 '=/ bridge\n' + tests +
18 '\n(bridge-output:bridge declared-text missing-text sur-text collision-text)\n')
19with tempfile.TemporaryDirectory(prefix='jibb-type-mark-') as tmp:
20 program = Path(tmp) / 'bridge.hoon'
21 program.write_text(expression)
22 command = [str(root / 'tools/hoon'), '--raw', '-f', str(program)]
23 for name in ('declared', 'missing', 'sur', 'collision', 'expected'):
24 command += ['--cord', name + '-text=' + str(fixture / (name + '.txt'))]
25 result = subprocess.run(command, stdout=subprocess.PIPE)
27 sys.exit(result.returncode)
28expected = (fixture / 'expected.txt').read_bytes()
29if result.stdout != expected:
30 sys.stderr.writelines(difflib.unified_diff(
31 expected.decode().splitlines(keepends=True),
32 result.stdout.decode().splitlines(keepends=True),
33 fromfile='expected.txt', tofile='actual types'))
35print('mark/checker bridge golden 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