X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/43ce48fd4112471e4c7ef083297688fc45add4a8..b2983f3591981a916f748362d91ff0e2817552cb:/test/test.sod diff --git a/test/test.sod b/test/test.sod index 71fdd68..f7f3537 100644 --- a/test/test.sod +++ b/test/test.sod @@ -202,4 +202,27 @@ code c : tests { } } +/*----- Slot and user initargs --------------------------------------------*/ + +[link = SodObject, nick = t2] +class T2 : SodObject { + [initarg = x] int x = 0; + + initarg int y = 1; + init { if (!y) STEP(0); } +} + +code c : tests { + prepare("initargs, defaults"); + { SOD_DECL(T2, t, NO_KWARGS); + if (t->t2.x == 0) STEP(0); + DONE(1); + } + prepare("initargs, explicit"); + { SOD_DECL(T2, t, KWARGS(K(x, 42) K(y, 0))); + if (t->t2.x == 42) STEP(1); + DONE(2); + } +} + /*----- That's all, folks -------------------------------------------------*/