Skip to content

Commit ea02b75

Browse files
claudeironm00n
andcommitted
test(core): add integration test for import-required guard with wheat
Demonstrates the key use case: a wheat test depends on the student having a particular import (`import image as I`). The DAG is: wf → import-required → fn-def → wheat Includes example student file, wheat implementation, and npm script. Co-authored-by: IRONM00N <me@ironmoon.dev>
1 parent 1815956 commit ea02b75

4 files changed

Lines changed: 46 additions & 0 deletions

File tree

pkgs/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"integration:gcd": "pnpm run pyret-trove -- -p tests/integration/inspect-gcd.arr",
1616
"integration:fold": "pnpm run pyret-trove -- -p tests/integration/inspect-fold.arr",
1717
"integration:tower": "pnpm run pyret-trove -- -p tests/integration/inspect-tower.arr",
18+
"integration:imports": "pnpm run pyret-trove -- -p tests/integration/inspect-imports.arr",
1819
"clean": "rm -rf -- ./pyret"
1920
},
2021
"dependencies": {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fun double(x):
2+
x * 2
3+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import image as I
2+
3+
fun double(x):
4+
x * 2
5+
where:
6+
double(3) is 6
7+
double(0) is 0
8+
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import file("../meta/path-utils.arr") as P
2+
include file("../meta/inspect-grade.arr")
3+
include file("../../src/main.arr")
4+
include file("../../src/tools/main.arr")
5+
6+
student-path = P.example("double.arr")
7+
wheat-path = P.example("double-grading/wheat.arr")
8+
9+
graders =
10+
[list:
11+
mk-well-formed("wf", [list:], student-path),
12+
mk-import-required(
13+
"import-image",
14+
[list: "wf"],
15+
student-path, "image", some("I")
16+
),
17+
mk-fn-def(
18+
"double-defined",
19+
[list: "import-image"],
20+
student-path, "double", 1
21+
),
22+
mk-wheat(
23+
"double-wheat",
24+
[list: "double-defined"],
25+
student-path, wheat-path, "double",
26+
1
27+
)
28+
]
29+
30+
result = inspect-grade(graders, true, false)
31+
32+
check "aggregate-to-flat smoke":
33+
grading-helpers.aggregate-to-flat(result.aggregated) does-not-raise
34+
end

0 commit comments

Comments
 (0)