aboutsummaryrefslogtreecommitdiff
path: root/tests/drivers/runtime_image_test.py
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 10:38:17 +0000
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 10:38:17 +0000
commit93340f97dce404a008f489729df144ace53528ab (patch)
treecbada309f3a4683d083d84484f11952418c8dd2b /tests/drivers/runtime_image_test.py
parenttodo: handoff section with state, conventions, in-flight work and architectur... (diff)
fix std hover, full capture terminator, bare static calls, void main in run-only images
- hover: a symbol from an embedded library source (tinyvm:std.zc, tinyvm:icon.zc) was looked up only in the document; look it up by its qualified name in the library source (hover_embedded_sym), and render a method found that way by its line (bs_hover). - std.capture: allocate one word more than the 256 it holds, so end() terminates inside the buffer. - a bare call to a static function of the enclosing struct resolves like a bare struct constant (mstruct is set for every non-generic struct's methods); the struct's own wins over a global. - run.zc declares main untyped (fn main();), so a run-only image accepts int, void or untyped main with both compilers.
Diffstat (limited to 'tests/drivers/runtime_image_test.py')
-rw-r--r--tests/drivers/runtime_image_test.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/drivers/runtime_image_test.py b/tests/drivers/runtime_image_test.py
index d214613..6c44349 100644
--- a/tests/drivers/runtime_image_test.py
+++ b/tests/drivers/runtime_image_test.py
@@ -18,6 +18,8 @@ cases = [
('enhancements', 'include rt; fn main() { rt.put_n(17 % 5); rt.put_c(32); rt.put_n(17 / 5); }', b'2 3'),
('array algorithms', Path('examples/learn/31-array-algorithms.zc').read_text(), Path('examples/learn/31-array-algorithms.out').read_bytes()),
('owned pop', 'include rt; int*.u take() { int*[?] a = rt.new(int*[?]); int* p = rt.new(int); *p = 8; a.push(p); return a.pop(); } fn main() { let p = take(); rt.put_n(rt.isobj(p)); rt.put_c(32); rt.put_n(*p); }', b'1 8'),
+ # main may be void: run.zc's prototype of main must not fix its type (docs/SPEC.md 5.2.5)
+ ('void main', Path('tests/programs/void_main.zc').read_text(), b'void main\n'),
]
prefix = b''.join(Path(f).read_bytes() + b'\n' for f in ['src/runtime/rt.zc', 'src/core/core.zc', 'src/runtime/run.zc'])
for name, source, expected in cases: