test: group examples into per-category folders

Move examples/*.sx and their expected/ snapshots into per-category
subfolders (examples/<category>/...). Folder = leading filename token,
with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus
runner and LSP sweep now discover each category's expected/ dir, while
issues/ stays flat. Example 1058's repo-root-relative companion import
is made file-relative. Path strings embedded in 164 snapshots were
regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
This commit is contained in:
agra
2026-06-21 14:41:34 +03:00
parent 6d1409bc1f
commit 66bdc70bf1
3357 changed files with 456 additions and 363 deletions

View File

@@ -0,0 +1 @@
42

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
Hello

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,4 @@
scope opened
scoped x: 6
scope closed
main x: 42

View File

@@ -0,0 +1 @@
42

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
still here

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
hello from the other side

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
[1.000000, 0.000000, -1.000000]

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,4 @@
count: 5
break at: 12
sum of odd 1-9: 25
sum 55

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
containedcontainedcontained

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
[1, 2, 2, 2, 3, 3, 4, 5, 5, 6, 6, 333]

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,41 @@
--- tagged enum compat ---
T1: 3.140000
T2: 3
T3: 5.000000 3.000000
T4: 2.710000
T5: 9.500000
T6: 4.199999
T7a: 1.000000
T7b: 2.000000 3.000000
T7c: 3
T8a: 10
T8b: 20
T8c: 30
T9: 42
T10a: 1
T10b: 1.000000
T10c: 9.000000
--- struct static shorthand ---
S1: 3.000000 4.000000
S2: 5.000000 6.000000
S3: 7.000000 8.000000
S4: 0.000000 0.000000
S4: 1.000000 0.000000
S5: 60
S6: 8.000000 8.000000 8.000000 8.000000
S6: 8.000000 16.000000 8.000000 16.000000
S6: 0.000000 12.000000 0.000000 12.000000
S7: 7
S8: 3.000000 4.000000
S8q: 1.000000 2.000000
S9: 4.000000 6.000000
S10: 4.000000 6.000000
--- edge cases ---
E1: 5.000000 1.000000 2.000000
E2: 9 1.000000 2.000000
E3: 1
E4: 4.000000 6.000000
E5: 42
E6: 1
E7: 20.000000 10.000000
=== DONE ===

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,5 @@
double: 14
sum: 7
answer: 42
total: 30
scaled: 90

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,10 @@
i=0
i=1
i=2
n=5
j=2
j=3
j=4
[0]=A
[1]=B
[2]=A

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
101 102 103
circle 2.000000
none

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,4 @@
sum 60
sum2 360
via ptr 360
boxes 7

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,18 @@
=== 1. Literals ===
decimal: 42
hex: 255
binary: 10
float: 3.140000
f64: 2.718281
true: true
false: false
escapes: hello world
multiline: line1
line2
heredoc: raw heredoc
undef-then-set: 77
enum-lit: .green
null-ptr: null
string-len: 5
empty-string: 0

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,60 @@
=== 2. Operators ===
add: 7
sub: 7
mul: 42
div: 5
mod: 2
neg: -5
eq: true
neq: true
lt: true
gt: true
le: true
ge: true
chain: true
chain-gt: true
chain-mixed: true
eq-chain: true
eq-chain-f: false
band: 15
bor: 7
bxor: 240
bxor2: 5
bnot: -1
bnot2: -2
shl: 16
shr: 16
shl2: 24
shr2: 127
band-var: 15
bor-var: 7
bxor-var: 240
shl-var: 16
shr-var: 15
bnot-var: -16
and-assign: 15
or-assign: 255
xor-assign: 240
shl-assign: 256
shr-assign: 16
mod-var: 2
and: true
and-false: false
or: true
or-false: false
short-and: false
short-or: true
ca+=: 15
ca-=: 12
ca*=: 24
ca/=: 4
prec1: 14
prec2: 20
xx-cast: 200
widen-u8-i64: 200
widen-i32-f64: 42.000000
widen-f32-f64: 1.500000
widen-u8-i16: 100
xx-i64-i32: 12345
xx-f64-f32: 1.500000
xx-f64-i32: 7

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,26 @@
=== 4. Control Flow ===
ite: 1
ite-both: 10 20
if-block: yes
if-no-else: after
nested-if: deep
if-else-if: second
if-block-expr: 15
while: 5
while-false: skipped
while-break: 7
while-continue: 25
while-sum: 55
nested-while: 9
nested-break: 2 2
for: 10 20 30 40
for-print: 10 20 30 40
for-idx: 0 1 2 3
for-2arg: 10@0 20@1 30@2 40@3
for-break: 10 20
for-continue: 10 30 40
for-slice: 10 20 30
for-slice-idx: 0:10 1:20 2:30
for-nested: (0,0) (0,1) (1,0) (1,1)
for-break-idx: 2
multi: 1 2 3

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,21 @@
=== 5. Functions ===
const: 42
typed-const: 3.140000
default-init: 0
implicit-ret: 42
early-ret: 5
early-ret2: 99
void-return: ok
generic-i32: 42
generic-f32: 1.500000
generic-bool: true
generic-multi: 30
lambda: 14
lambda-ret: 5.000000
local-fn: 7
fn-nested: 26
varargs: 15
spread: 60
fp: 7
fp-reassign: 12
fp-apply: 30

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,23 @@
=== 6. Scoping ===
inner: 200
outer: 100
shadow-type: 42
shadow-type: 3.140000
nest3: 3
nest2: 2
nest1: 1
scope-isolate: 100
scope-reuse: 1
scope-reuse: 2
scope-reuse: 1
defer-a
defer-b
defer-c
d4
d3
d2
d1
inner-defer
outer-defer
defer-in-if: body
defer-in-if: deferred

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,31 @@
=== 7. Builtins ===
out-ok
sqrt: 3.000000
sqrt-f64: 4.000000
sizeof-i32: 4
sizeof-f64: 8
sizeof-struct: 8
alignof-u8: 1
alignof-i32: 4
alignof-i64: 8
alignof-struct: 4
typeof: int
typeof-float: float
typeof-string: string
typeof-bool: bool
typeof-struct: struct
typeof-enum: enum
typename: Point
fieldcount: 2
fieldcount-enum: 3
fieldname0: x
fieldname1: y
fieldname-enum0: red
fieldname-enum2: blue
fieldval0: 11
fieldval1: 22
fieldidx: 1
fieldidx-tagged: 0
fieldidx-tagged2: 2
cast: 3
cast-int-f64: 42.000000

View File

@@ -0,0 +1 @@
0

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
=== 19. Local Fn Return ===
local-struct: 42 99
local-enum: .circle(2.500000)

View File

@@ -0,0 +1 @@
0

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
=== 20. UFCS Return Type ===
direct: 7
ufcs: 7

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
=== 22. If-Struct ===
if-struct: 10 20
else-struct: 30 40

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,5 @@
=== 24. String Comparison ===
str-eq: true
str-neq: true
str-diff: false
empty-eq: true

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
=== 25. Array Loop Mutation ===
loop-fill: 1 2 3 4
compound: 13

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,12 @@
=== UFCS Aliases ===
42
42
42
42
42
3
3
3
2
1
99

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,2 @@
=== Trailing Commas ===
trailing commas ok

View File

@@ -0,0 +1,4 @@
const_one=1
raised=0
clamp_hi=10
clamp_lo=7

View File

@@ -0,0 +1,2 @@
a=11 b=12 n=12
after reset n=0

View File

@@ -0,0 +1 @@
35

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
block-value total: 35

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,5 @@
error: function returns 'i32' but the last expression's value is discarded by this `;` — drop the `;` to return it (or use an explicit `return`)
--> examples/basic/0041-basic-block-value-reject.sx:10:10
|
10 | n * 2;
| ^

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
12

Some files were not shown because too many files have changed in this diff Show More