Rename all example tests/companions to the XXXX-category-test-name scheme (per-category 100-blocks: basic 0010, types 0100, ... errors 1000, diagnostics 1100, ffi 1200, ffi-objc 1300, ffi-jni 1400, vectors 1500, platform 1600). Companions and dir/C fixtures move in lockstep with their parent test; #import/#source/#include paths rewritten to match. Expected output now lives in examples/expected/ (a sibling dir of the tests) split into three streams per the new convention: <name>.exit / <name>.stdout / <name>.stderr (+ optional <name>.ir) run_examples.sh rewritten: scans examples/ and issues/ for an expected/<name>.exit marker, captures stdout and stderr separately (no more 2>&1), compares each stream + exit + optional IR snapshot. Behavior validated unchanged: every renamed test reproduces its prior merged output + exit (diffs limited to file paths/basenames embedded in diagnostics + traces, which correctly reflect the new names). Suite: 292 passed, 0 failed. 50-smoke.sx split + issue relocation + docs follow in subsequent commits.
48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
// Phase 2 step 2.7 (PLAN-FFI.md): xfail then green for the remaining
|
|
// six type-introducer directive forms parsing with the same body
|
|
// grammar as `#jni_class`. No codegen yet — Phase 3 picks up Obj-C
|
|
// codegen, Phase 4 picks up Swift.
|
|
//
|
|
// The directives this step turns on:
|
|
// #jni_interface — Java interface binding
|
|
// #objc_class — Obj-C class binding
|
|
// #objc_protocol — Obj-C protocol binding
|
|
// #swift_class — Swift class binding (via @_cdecl bridge)
|
|
// #swift_struct — Swift @frozen value-type binding
|
|
// #swift_protocol — Swift @objc-bridgeable protocol binding
|
|
//
|
|
// Internally the AST collapses into one `foreign_class_decl` node
|
|
// carrying a `runtime` discriminator. Today the parser rejects each
|
|
// of these because the lexer doesn't recognise the directive name.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
IFoo :: #foreign #jni_interface("com/example/IFoo") {
|
|
bar :: (self: *Self) -> s32;
|
|
}
|
|
|
|
NSString :: #foreign #objc_class("NSString") {
|
|
length :: (self: *Self) -> s32;
|
|
}
|
|
|
|
NSCopying :: #foreign #objc_protocol("NSCopying") {
|
|
copy :: (self: *Self) -> *Self;
|
|
}
|
|
|
|
URL :: #foreign #swift_class("Foundation.URL") {
|
|
absoluteString :: (self: *Self) -> *void;
|
|
}
|
|
|
|
Date :: #foreign #swift_struct("Foundation.Date") {
|
|
timeIntervalSince1970 :: (self: *Self) -> f64;
|
|
}
|
|
|
|
Hashable :: #foreign #swift_protocol("Swift.Hashable") {
|
|
hash :: (self: *Self) -> s32;
|
|
}
|
|
|
|
main :: () -> s32 {
|
|
print("parse-only ok\n");
|
|
0;
|
|
}
|