X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/a469422e9be4244c098a309e78aa3b761cf0a5ec..a985964182dbe5ea2e2ecda240fc862f13008820:/test/test.sod diff --git a/test/test.sod b/test/test.sod index 429e384..5a029cd 100644 --- a/test/test.sod +++ b/test/test.sod @@ -167,6 +167,7 @@ class T1Base: SodObject { [combination = sum] int asum(); [combination = and] int aand(); [combination = max] int amax(); + [role = around] int base.asum() { return (CALL_NEXT_METHOD); } [combination = custom, empty = { sod_ret = 0; }, @@ -352,4 +353,26 @@ code c: tests { DONE(3); } +/*----- Static instances --------------------------------------------------*/ + +[link = SodObject, nick = st] +class StaticObject: SodObject { + int x, y = 2, z = 3; + [readonly = t] void step() { STEP(me->st.x); } +} + +[extern = t] instance StaticObject mystatic: st.x = 0, st.z = 69; +[const = nil] instance StaticObject otherstatic: st.x = 3, st.y = 42; + +code c: tests { + prepare("static instance"); + StaticObject_step(mystatic); + if (mystatic->st.y == 2) STEP(1); + if (mystatic->st.z == 69) STEP(2); + StaticObject_step(otherstatic); + if (otherstatic->st.y == 42) STEP(4); + if (otherstatic->st.z == 3) STEP(5); + DONE(6); +} + /*----- That's all, folks -------------------------------------------------*/