2"""Compare the module/prelude scope report under urbit eval."""
4from pathlib import Path
10root = Path(__file__).resolve().parent.parent
11fixture = root / 'tests/type-module-scope/expected.txt'
12tests = (root / 'tests/lib/jibb-module-scope.hoon').read_text()
13tests = tests[tests.index('\n|%\n') + 1:]
14expression = ('=/ jibb .\n=/ expected=wain (to-wain:format expected-text)\n'
15 '=/ real-prelude=@t prelude-text\n=/ real-source=@t source-text\n'
16 '=/ real-left=@t left-text\n=/ real-right=@t right-text\n'
17 '=/ real-expected=wain (to-wain:format types-text)\n'
18 '=/ suite\n' + tests + '\nscope-output:suite\n')
19with tempfile.TemporaryDirectory(prefix='jibb-module-scope-') as tmp:
20 program = Path(tmp) / 'scope.hoon'
21 program.write_text(expression)
22 result = subprocess.run([str(root / 'tools/hoon'), '--raw', '-f', str(program),
23 '--cord', 'expected-text=' + str(fixture),
24 '--cord', 'prelude-text=' + str(root / 'jibb-dev/lib/jibb/prelude.jibb'),
25 '--cord', 'source-text=' + str(root / 'tests/golden/types-prelude-interface/source.jibb'),
26 '--cord', 'left-text=' + str(root / 'tests/golden/types-prelude-interface/modules/ui/left.jibb'),
27 '--cord', 'right-text=' + str(root / 'tests/golden/types-prelude-interface/modules/ui/right.jibb'),
28 '--cord', 'types-text=' + str(root / 'tests/golden/types-prelude-interface/types.txt')],
29 stdout=subprocess.PIPE)
31 sys.exit(result.returncode)
32expected = fixture.read_bytes()
33if result.stdout != expected:
34 sys.stderr.writelines(difflib.unified_diff(
35 expected.decode().splitlines(keepends=True),
36 result.stdout.decode().splitlines(keepends=True),
37 fromfile='expected.txt', tofile='actual types'))
39print('module/prelude scope 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