!include once #1034831 // Gazelle 22 Function Include for Testing scope test_leftArrowScript_tilde sclass #GetOptImpl { public O getOpt(S key) { ret key + "!"; } } svoid test_leftArrowScript_tilde() { var test = new TestFunctionValues(l1 leftArrowVerbose); // function inversion with an extra argument (2 in total) test .io([[litmap "a" 2 "b" 3, ~a]], 2) .io([[litmap "a" 2 "b" 3, ~b]], 3) .io([[litmap "a" 2 "b" 3, ~c]], null) .io([[litmap "a" (litmap "x" 2) "b" 3, ~a ~x]], 2).runAndClear(); // get list element test .io([[ll "a" "b", ~0]], "a") .io([[ll "a" "b", ~1]], "b") .io([[ll "a" "b", ~2]], null) .runAndClear(); // tilde directly after function call test .io([[def bla { litmap "a" 2 } bla~a]], 2) .runAndClear(); // Any object implementing getOpt(key) test .io(replaceIdentifiers([[new GetOptImpl, ~hey]], "GetOptImpl", className(GetOptImpl)), "hey!") .runAndClear(); // It's okay to do "null, ~whatever" test .io("null, ~bla", null) .runAndClear(); }