Skip to content

Commit

Permalink
Add some extra test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Alasdair committed Aug 5, 2024
1 parent bea3398 commit 5d35b1a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
13 changes: 13 additions & 0 deletions test/typecheck/project/fail_simple.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Type error:
project/simple/bmod.sail:3.18-23:
3 |function main() = hello()
 | ^---^
 | Not in scope
 |
 | Try requiring module A to bring the following into scope for module B:
 | project/simple/amod.sail:5.4-9:
 | 5 |val hello : unit -> unit
 |  | ^---^ definition here in A
 | project/fail_simple.sail_project:6.0-1:
 | 6 |B {
 |  |^ add 'requires A' within B here
8 changes: 8 additions & 0 deletions test/typecheck/project/fail_simple.sail_project
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

A {
files simple/amod.sail
}

B {
files simple/bmod.sail
}
11 changes: 11 additions & 0 deletions test/typecheck/project/submodules_include.sail_project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

A {
ASub {
files simple/amod.sail
}
}

B {
requires A
files simple/bmod.sail
}
10 changes: 8 additions & 2 deletions test/typecheck/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,20 @@ def test_pass():
return results.finish()

def test_projects():
banner('Testing passing projects')
banner('Testing multi-file projects')
results = Results('projects')
for filenames in project_chunks(os.listdir('project'), parallel()):
tests = {}
for filename in filenames:
basename = os.path.splitext(os.path.basename(filename))[0]
tests[filename] = os.fork()
if tests[filename] == 0:
step('{} --no-memo-z3 project/{} --all-modules'.format(sail, filename))
if filename.startswith('fail'):
step('{} --no-memo-z3 project/{} --all-modules 2> project/{}.error'.format(sail, filename, basename), expected_status = 1)
step('diff project/{}.error project/{}.expect'.format(basename, basename))
step('rm project/{}.error'.format(basename))
else:
step('{} --no-memo-z3 project/{} --all-modules'.format(sail, filename))
print_ok(filename)
sys.exit()
results.collect(tests)
Expand Down

0 comments on commit 5d35b1a

Please sign in to comment.