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.
36 lines
563 B
Plaintext
36 lines
563 B
Plaintext
#import "modules/std.sx";
|
|
|
|
sum :: (..args: []i32) -> i32 {
|
|
result := 0;
|
|
for args (it) {
|
|
result = result + it;
|
|
}
|
|
result
|
|
}
|
|
|
|
print_all :: (..args: []i32) {
|
|
for args (it) {
|
|
out(int_to_string(it));
|
|
out(" ");
|
|
}
|
|
out("\n");
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
out(int_to_string(sum(10, 20, 30)));
|
|
out("\n");
|
|
|
|
print_all(1, 2, 3, 4, 5);
|
|
|
|
arr : [3]i32 = .[10, 20, 30];
|
|
out(int_to_string(sum(..arr)));
|
|
out("\n");
|
|
|
|
for arr (it) {
|
|
out(int_to_string(it));
|
|
out(" ");
|
|
}
|
|
out("\n");
|
|
0
|
|
}
|