--- linuxsampler/trunk/src/scriptvm/tests/NKSPCoreLangTest.cpp 2020/08/06 11:45:24 3803 +++ linuxsampler/trunk/src/scriptvm/tests/NKSPCoreLangTest.cpp 2020/08/06 12:15:02 3804 @@ -1075,6 +1075,74 @@ .expectParseError = true // assigning final to a non-final variable not allowed }); + // exit() acting as return statement ... + + runScript({ + .code = R"NKSP_CODE( +function doFoo + exit(2) { just return from this user function, i.e. don't stop init handler } +end function + +on init + call doFoo + exit(3) +end on +)NKSP_CODE", + .expectIntExitResult = 3 + }); + + runScript({ + .code = R"NKSP_CODE( +function doFoo1 + exit(2) { just return from this user function, i.e. don't stop init handler } +end function + +function doFoo2 + call doFoo1 + exit(3) { just return from this user function, i.e. don't stop init handler } +end function + +on init + call doFoo2 + exit(4) +end on +)NKSP_CODE", + .expectIntExitResult = 4 + }); + + runScript({ + .code = R"NKSP_CODE( +function doFoo + exit(2) { just return from this user function, i.e. don't stop init handler } +end function + +on init + call doFoo + exit(3) + { dead code ... } + call doFoo + exit(4) +end on +)NKSP_CODE", + .expectIntExitResult = 3 + }); + + runScript({ + .code = R"NKSP_CODE( +function doFoo + exit(2) { just return from this user function, i.e. don't stop init handler } +end function + +on init + call doFoo + exit(3) + { dead code ... } + call doFoo +end on +)NKSP_CODE", + .expectIntExitResult = 3 + }); + #if !SILENT_TEST std::cout << std::endl; #endif