Skip to content

Commit c7e1858

Browse files
committed
feat: Small test suite and instructions for Codex
- add a small Minitest test suite Minitest is included in the standard Ruby distribution. - add a Justfile with a single `test` target (aliased to `t`) You'll need to install `just` separately. A follow up commit will add it as a dependency in a Nix/direnv based dev env. - add instructions for Codex agents
1 parent 6771e06 commit c7e1858

File tree

10 files changed

+1198
-0
lines changed

10 files changed

+1198
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
*.json
2+
!test/fixtures/*.json
3+
test/tmp/

AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Instructions for Codex
2+
3+
To run the test suite, execute:
4+
5+
```
6+
just test
7+
```
8+
9+
This will run the ruby test file at `test/test_tracer.rb` which traces sample programs and compares their outputs to the fixtures in `test/fixtures`.

Justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
alias t := test
2+
3+
test:
4+
ruby -Itest test/test_tracer.rb

test/fixtures/addition_trace.json

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
[
2+
{
3+
"Type": {
4+
"kind": 7,
5+
"lang_type": "Integer",
6+
"specific_info": {
7+
"kind": "None"
8+
}
9+
}
10+
},
11+
{
12+
"Type": {
13+
"kind": 9,
14+
"lang_type": "String",
15+
"specific_info": {
16+
"kind": "None"
17+
}
18+
}
19+
},
20+
{
21+
"Type": {
22+
"kind": 12,
23+
"lang_type": "Bool",
24+
"specific_info": {
25+
"kind": "None"
26+
}
27+
}
28+
},
29+
{
30+
"Type": {
31+
"kind": 9,
32+
"lang_type": "Symbol",
33+
"specific_info": {
34+
"kind": "None"
35+
}
36+
}
37+
},
38+
{
39+
"Type": {
40+
"kind": 24,
41+
"lang_type": "No type",
42+
"specific_info": {
43+
"kind": "None"
44+
}
45+
}
46+
},
47+
{
48+
"Path": ""
49+
},
50+
{
51+
"Function": {
52+
"path_id": 0,
53+
"line": 1,
54+
"name": "<top-level>"
55+
}
56+
},
57+
{
58+
"Call": {
59+
"function_id": 0,
60+
"args": [
61+
62+
]
63+
}
64+
},
65+
{
66+
"Path": "test/programs/addition.rb"
67+
},
68+
{
69+
"Step": {
70+
"path_id": 1,
71+
"line": 1
72+
}
73+
},
74+
{
75+
"Step": {
76+
"path_id": 1,
77+
"line": 5
78+
}
79+
},
80+
{
81+
"Type": {
82+
"kind": 16,
83+
"lang_type": "Object",
84+
"specific_info": {
85+
"kind": "None"
86+
}
87+
}
88+
},
89+
{
90+
"VariableName": "self"
91+
},
92+
{
93+
"Value": {
94+
"variable_id": 0,
95+
"value": {
96+
"kind": "Raw",
97+
"type_id": 5,
98+
"r": "main"
99+
}
100+
}
101+
},
102+
{
103+
"VariableName": "a"
104+
},
105+
{
106+
"Value": {
107+
"variable_id": 1,
108+
"value": {
109+
"kind": "Int",
110+
"type_id": 0,
111+
"i": 1
112+
}
113+
}
114+
},
115+
{
116+
"VariableName": "b"
117+
},
118+
{
119+
"Value": {
120+
"variable_id": 2,
121+
"value": {
122+
"kind": "Int",
123+
"type_id": 0,
124+
"i": 2
125+
}
126+
}
127+
},
128+
{
129+
"Step": {
130+
"path_id": 1,
131+
"line": 1
132+
}
133+
},
134+
{
135+
"Function": {
136+
"path_id": 1,
137+
"line": 1,
138+
"name": "add"
139+
}
140+
},
141+
{
142+
"Call": {
143+
"function_id": 1,
144+
"args": [
145+
{
146+
"variable_id": 0,
147+
"value": {
148+
"kind": "Raw",
149+
"type_id": 5,
150+
"r": "main"
151+
}
152+
},
153+
{
154+
"variable_id": 1,
155+
"value": {
156+
"kind": "Int",
157+
"type_id": 0,
158+
"i": 1
159+
}
160+
},
161+
{
162+
"variable_id": 2,
163+
"value": {
164+
"kind": "Int",
165+
"type_id": 0,
166+
"i": 2
167+
}
168+
}
169+
]
170+
}
171+
},
172+
{
173+
"Step": {
174+
"path_id": 1,
175+
"line": 2
176+
}
177+
},
178+
{
179+
"Value": {
180+
"variable_id": 1,
181+
"value": {
182+
"kind": "Int",
183+
"type_id": 0,
184+
"i": 1
185+
}
186+
}
187+
},
188+
{
189+
"Value": {
190+
"variable_id": 2,
191+
"value": {
192+
"kind": "Int",
193+
"type_id": 0,
194+
"i": 2
195+
}
196+
}
197+
},
198+
{
199+
"Step": {
200+
"path_id": 1,
201+
"line": 3
202+
}
203+
},
204+
{
205+
"VariableName": "<return_value>"
206+
},
207+
{
208+
"Value": {
209+
"variable_id": 3,
210+
"value": {
211+
"kind": "Int",
212+
"type_id": 0,
213+
"i": 3
214+
}
215+
}
216+
},
217+
{
218+
"Return": {
219+
"return_value": {
220+
"kind": "Int",
221+
"type_id": 0,
222+
"i": 3
223+
}
224+
}
225+
},
226+
{
227+
"Step": {
228+
"path_id": 1,
229+
"line": 5
230+
}
231+
},
232+
{
233+
"Event": {
234+
"kind": 0,
235+
"content": "3",
236+
"metadata": ""
237+
}
238+
}
239+
]

0 commit comments

Comments
 (0)