polserver/testsuite/escript/condexpr/condexpr01.src

30 lines
581 B
Text
Raw Permalink Normal View History

function Call(byref val)
return ++val;
endfunction
function DoNotCall()
print("TEST FAILURE");
return error{ errortext := "Called!" };
endfunction
var foo, i := 0;
foo := 1 ? Call(i) : DoNotCall();
print(foo);
foo := 0 ? DoNotCall() : Call(i);
print(foo);
foo := -1 > 0 ? DoNotCall() : Call(i);
print(foo);
foo := -1 > 0 ? DoNotCall() : 0 > 1 ? DoNotCall() : Call(i);
print(foo);
foo := 0 ?: "" ? DoNotCall() : uninit ?: 0 ? DoNotCall() : Call(i);
print(foo);
var bar := struct{};
foo := bar.+baz := "" ?: "truthty" ? 1 : 0 ? Call(i) : DoNotCall();
print(foo);