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 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,6 @@
v1: Vec4{x: 1.000000, y: 2.000000, z: 3.000000, w: 0.000000}
v2: Vec4{x: 4.000000, y: 1.000000, z: 1.000000, w: 3.000000}
v3: Vec4{x: 2.000000, y: 3.000000, z: 4.000000, w: 0.000000}
v4: Vec4{x: 9.000000, y: 0.000000, z: 5.000000, w: 6.000000}
Complex{foo: .B(Complex.foo.B{val: hello})}

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,4 @@
a 0 : Foo{a: 0, b: 42, c: 0, d: 17}
a 1 : Foo{a: 1, b: 42, c: 8, d: 17}
b: Foo{a: 1, b: 42, c: 101, d: 17}
Pack{a: 1, b: 0, c: 3, d: 5, f: 9, v: 100, x: 3.500000}

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,8 @@
circle: .circle(3.140000)
radius: 3.140000
none: .none
rect: .rect(Shape.rect{w: 4.000000, h: 2.000000})
sh: .circle(2.710000)
rect val: Shape.rect{w: 2.000000, h: 4.000000}
matched rect
case : 2

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,7 @@
p: Point{x: 10, y: 20}
c: Color{r: 255, g: 128, b: 0}
n: 42
s: hello
b: true
&p: *Point@0xADDR
&p: *Point@0xADDR

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,6 @@
f=3.140000
i=1078523331
x=1.000000
y=2.000000
data[0]=1.000000
data[1]=2.000000

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,26 @@
perms: .read | .write
checking: .read | .write
- can read
- can write
all: .read | .write | .execute
checking: .read | .write | .execute
- can read
- can write
- can execute
read only: .read
checking: .read
- can read
match on flags:
execute
window: .vsync | .resizable
raw value: 68
color: .blue
raw: 2
0xFF & 0x0F = 15
1 | 2 | 4 = 7

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,10 @@
add: 13
sub: 5
mul: 60
div: 5
mod: 1
and: 15
or: 255
xor: 240
shl: 64
shr: 8

View File

@@ -0,0 +1 @@
0

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
ok
result = 1.000000

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,4 @@
size_of BigNode = 40
before: sentinel = 3735928559
after: sentinel = 3735928559
OK

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,10 @@
--- Test 1: += (broken) ---
Expected: 1, 2, 3
counter=1
counter=2
counter=3
--- Test 2: = x + 1 (works) ---
Expected: 2, 3, 4
counter=4
counter=5
counter=6

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,2 @@
VALS: -2 -1 42 99
PASS

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,6 @@
local running=true x=42 name=default
g_empty running=true x=42 name=default
g_partial running=true x=99 name=default
g_override running=false x=42 name=default
g_reorder running=false x=7 name=hi
g_positional running=false x=13 name=pos

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
count = 42
pi = 3.140000
flag = true

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,10 @@
--- void / 0 args ---
__invoke :: (block_self: *Block) -> void abi(.c) { typed_fn : (*void) -> void = xx block_self.sx_fn; typed_fn(block_self.sx_env); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, };
--- void / bool ---
__invoke :: (block_self: *Block, arg0: bool) -> void abi(.c) { typed_fn : (*void, bool) -> void = xx block_self.sx_fn; typed_fn(block_self.sx_env, arg0); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, };
--- void / i64, string ---
__invoke :: (block_self: *Block, arg0: i64, arg1: string) -> void abi(.c) { typed_fn : (*void, i64, string) -> void = xx block_self.sx_fn; typed_fn(block_self.sx_env, arg0, arg1); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, };
--- i32 / f64 ---
__invoke :: (block_self: *Block, arg0: f64) -> i32 abi(.c) { typed_fn : (*void, f64) -> i32 = xx block_self.sx_fn; return typed_fn(block_self.sx_env, arg0); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, };
--- build done ---
rt

View File

@@ -0,0 +1,10 @@
size_of(*u8) = 8
align_of(*u8) = 8
size_of(?u8) = 2
size_of([3]u8) = 3
size_of((i32)->i32) = 8
size_of((i32, i32)) = 8
size_of(Ptr) = 8
size_of(Maybe) = 2
size_of(Arr) = 3
size_of(Cb) = 8

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,7 @@
direct i32: 4
alias i32: 4
chain i32: 4
align alias: 4
align chain: 4
size struct-alias: 16
align struct-alias:8

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
got: <hello>

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,59 @@
=== 1. literal == ===
i64 == i64: true
i64 == string: false
*u8 == *u8: true
?i64 == ?i64: true
?i64 == ?i32: false
=== 2. type_of(value) == T ===
type_of(a) == i64: true
type_of(b) == f64: true
type_of(s) == string: true
type_of(a) == f64: false
=== 3. Type variable storage ===
t == f64: true
t == string: false
after reassign t == string: true
t == bool: true
=== 4. type_name ===
type_name(i64): i64
type_name(*u8): *u8
type_name(Point): Point
type_name(Color): Color
type_name(t): f64
=== 5. print Type values ===
literal: i64
var: string
type_of(b): f64
=== 6. generic dispatch ===
describe(i64): int64
describe(string): text
describe(bool): boolean
describe(f64): other
=== 7. identity($T, val) ===
identity(i64, 7): 7
identity(string, hi): hi
identity(bool, true): true
=== 8. Wrap($T) ===
Wrap(i64).v: 42
Wrap(string).v: wrapped
=== 9. reflection on Type ===
size_of(i64): 8
size_of(*u8): 8
align_of(f64): 8
field_count(Point): 2
type_eq(i64, i64): true
type_eq(i64, string): false
=== 10. ..$args walking ===
type_list(): []
type_list(1): [i64]
type_list(1, "x"): [i64, string]
type_list(true, 3.14): [bool, f64]
=== 11. Type in struct field ===
h.t == i64: true
h.t == string: false
type_name(h.t): i64
=== 12. compound literals ===
type_name(*Point): *Point
type_name([4]i32): [4]i32
type_name([]bool): []bool
type_name(?f64): ?f64

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,12 @@
pair 40 2
named 10 10 20
locals 40 2
field 7 9
ret 2 1
pass 11
eq true
concat 1 4
rep 1 2
mem true
lex true
mixed 42 hi

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,3 @@
a: 11 x
p: x=22 y=y .0=22
p.x after .0=33: 33

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,75 @@
=== 3. Types ===
i8: 127
i16: 32000
i32: 100000
u8: 255
u16: 65000
u32: 4000000
alias: 1.500000
struct-pos: Point{x: 1, y: 2}
struct-prefix: Point{x: 3, y: 4}
struct-named: Point{x: 20, y: 10}
struct-shorthand: Point{x: 5, y: 6}
defaults: a=0 b=99
field-assign: Point{x: 42, y: 99}
enum: .red
enum-eq: true
enum-neq: true
backing: .err
tagged: .circle(3.140000)
payload: 3.140000
void-variant: .none
reassign: .circle(1.000000)
reassign2: .rect(Shape.rect{w: 5.000000, h: 3.000000})
enum-prefix: .circle(2.500000)
match: rect
match-expr: 10
match-expr-else: 99
capture: 9.500000
capture-arrow: 7.500000
else-match: other
int-match: two
int-match-else: unknown
bool-match-t: yes
bool-match-f: no
bool: true
union-f: 3.140000
union-i: 1078523331
promoted-x: 1.000000
promoted-data0: 1.000000
arr[2]: 30
arr.len: 5
arr-assign: [1, 99, 3]
sl[0]: 1
sl.len: 5
sl-assign: [10, 55, 30]
sub: [20, 30, 40]
head: [10, 20, 30]
tail: [30, 40, 50]
slice-of-slice: [20, 30]
strsub: world
str-prefix: hello
str-suffix: world
global-addr-of: 99
deref: Point{x: 10, y: 20}
auto-deref: 10
mp[0]: 10
mp[3]: 40
mp-write: 99
ptr==null: true
ptr!=null: false
ptr2==null: false
ptr2!=null: true
ptr-nested-field: 1.000000 2.000000 3.000000
mp-store-sentinel: 42
vec-construct: [1.000000, 3.000000, 2.000000]
vec-add: [5.000000, 7.000000, 9.000000]
vec-sub: [4.000000, 3.000000, 2.000000]
vec-mul: [2.000000, 6.000000, 12.000000]
vec-div: [5.000000, 3.000000, 2.000000]
vec-scalar: [2.000000, 6.000000, 4.000000]
vec-neg: [-1.000000, -3.000000, -2.000000]
vec-x: 10.000000
vec-y: 20.000000
vec-z: 30.000000
vec-idx: 20.000000

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,18 @@
=== 9. Flags ===
flags: .read | .write
has-read: yes
flags-neg: no-read
flags-single: .execute
flags-all: .read | .write | .execute
flags-raw: 3
flags-explicit: .vsync | .resizable
flags-explicit-raw: 68
--- swap ---
var swap: 20 10
arr swap: 3 1
3-way: 3 1 2
--- destructure ---
basic: 10 20
fn: 2 1
discard: 200
triple: 1 2 3

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
=== 16. Compound Assign ===
f64+=f32: 13.000000
i64-=i32: 93

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,4 @@
=== 18. Array of Structs ===
arr-struct-x: 3
for-struct: Point{x: 1, y: 2}
for-struct: Point{x: 3, y: 4}

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,5 @@
error: 'i2' is a reserved type name and cannot be used as an identifier
--> examples/types/0125-types-type-named-var-rejected.sx:10:5
|
10 | i2 := 42;
| ^^

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,5 @@
=== 23. Nested Arrays ===
m[0][0]: 1
m[0][2]: 3
m[1][0]: 4
m[1][2]: 6

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,12 @@
=== 26. #using ===
using-x: 1
using-y: 2
using-z: 3
pkt-id: 10
pkt-ver: 42
pkt-pay: 99
sprite-px: 10
sprite-r: 255
sprite-scale: 1
say: hello (len=5)
n=42

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,8 @@
=== Tuples ===
40
2
10
10
42
0
0

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,203 @@
=== Tuple Operators ===
true
false
true
false
1
2
3
4
1
2
1
2
1
2
true
false
false
true
true
true
true
false
--- directory imports ---
7
30
hello from testpkg
cwd-import-ok
--- pipe operator ---
7
30
14
hello world
piped ok!
alloc len: 5
alloc[0]: 10
alloc[4]: 50
bytes len: 3
--- allocators ---
gpa allocs: 2
gpa final: 0
arena chunks: 1
arena overflow: 2
arena a1: 42
arena a3: 99
arena reset idx: 0
arena reset gpa: 1
arena deinit: 0
buf pos: 48
buf overflow: 0
buf reset: 0
1 == (1)
(1) == 1
1 == 1
--- optionals ---
opt x: 42
opt y: null
unwrap: 10
coalesce a: 42
coalesce b: 99
chained ?? c: 42
chained ?? d: 99
chained ?? e: 0
if-bind x: 7
if-bind y: none
match some: 55
match none: 0
wrap pos: 5
wrap neg: null
opt field default: null
opt field set: 42
opt param a: 42
opt param b: 0
opt param 7: 7
opt reassign: 42.500000
opt compute assign: 15.000000
opt re-null: 99.000000
generic opt 1: 5
generic opt 2: 7
generic opt 3: null
chain some: 10
chain none: 0
chain print: 20
chain null: null
deep chain 1: 99
deep chain 2: 0
narrow x: 42
narrow y else: null
narrow else x: 42
guard some: 42
guard none: 0
and both: 10 20
and one null
or guard: 7
or guard null: 0
nested narrow: 10 20
guard loop: 3
block-lambda: 50
block-lambda: 0
block-lambda: 100
hello block
named-fn-type: 7
xx-fnptr: 142
closure-type: fn_ptr-nonnull=true
closure-type: env-null=true
closure-call: 15
auto-promote: 20
auto-promote-var: 10
closure-capture: 52
closure-snapshot: 15
closure-nocap: 14
closure-multi: 33
closure-block: 60
closure-block: 0
closure-block: 100
[LOG] hello
closure-hof: 30
closure-hof-bare: 20
closure-f32: 10.000000
closure-bool: hello
closure-2p: 107
closure-3p: 61
closure-mix: Alice is 35
closure-rbool: false true
closure-reduce: 115
closure-factory: 105 110
closure-struct: 10 20
closure-compose: 30
closure-indep: 15 50
opt-closure: none
opt-closure: 15
opt-closure-btn: 1 99
opt-closure-btn: null
closure-ptr: 3
closure-enum: 2
closure-rstr: [INFO] ok
closure-rstruct: 11 22
closure-linear: 37
closure-clamp: 0 100 255
closure-compose2: 12
closure-chain: 22
closure-map: 3 6 9 12 15
closure-filter: 3 [3 4 5]
closure-sort: 5 4 3 2 1
closure-fe: item 0=10
closure-fe: item 1=20
closure-fe: item 2=30
closure-find: 2
closure-any: false true
closure-struct-field: -5
closure-btn: 1 99
closure-counter: 1 2 3
closure-acc: 105 115
closure-loop: 115
closure-reassign: 11
closure-reassign: 20
closure-snapstruct: 15
closure-cap-promoted: 11
closure-iife: 15
closure-toggle: none
closure-toggle: true
closure-panel: main 800x600
closure-chain-call: true
closure-cond: 10
closure-form: submitted
closure-form: no cancel
closure-null-env: true
closure-slice: 10 20 30
closure-arena: 15
closure-gpa: 17 allocs=0
closure-opt: 42
closure-ropt: 50
closure-ropt: none
closure-mixed: 10
closure-mixed: 15
closure-mixed: 25
closure-factory-indep: 20 30 40
closure-deep-chain: 122
closure-8cap: 36
closure-4param: 10
closure-shared-ptr: 7
closure-f64: true
closure-zerocap: 49 true
closure-struct-method: 7
closure-multi-factory: 10
closure-multi-factory: 20
closure-multi-factory: 30
closure-bool-cap: true false
closure-as-arg: 142
closure-strfmt: hello world
closure-ptr-before: 10
closure-ptr-after: 42
closure-neg: -70
closure-proto-cap: true
closure-chain-factory: 37
closure-while-cond: 3
closure-infer: 7
closure-infer-arg: 15
closure-infer-block: 12
closure-infer-cap: 105
closure-infer-factory: 35
closure-infer-compose: 11
closure-infer-void: 42

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,4 @@
=== Struct Constants ===
gravity: 9.810000
max speed: 100
p.y: 9.810000

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,21 @@
=== Init Blocks ===
IB1: 60 3
IB2: 142 2
IB3: 5 1
IB4: 100
IB5: 52
--- struct static method shorthand ---
SM1: 16.000000 8.000000
SM1: 5.000000 5.000000
SM2: 10 20
--- optional if-else coercion ---
opt-if1: 99.000000
opt-if2: 10.000000
opt-if3: 10.000000
opt-if4: 0.000000
opt-if5: 42.000000
usize: 42
isize: -7
usize+8: 50
i32->usize: 10
usize->i64: 42

View File

@@ -0,0 +1 @@
7

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
chain i32: 4
forward u8: 1
v + n: 10

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