mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-20 03:14:45 +00:00
83533dc319
Currently functions only have very limited optional argument support, this expands it so that we can have more complex sets of optional arguments for functions, such as multiple arguments where not all need to be provided. This will be used in the future for some upcoming functionality. Note that this does not support any generic optional argument format, the commas always have to be provided unless an optional argument is at the end of the parameter list. Thus, if you have a format with two optional arguments and you want to omit the second, then you need to call it as 'foo(2, , 3)`, rather than `foo(2, 3)`. This is important for avoiding ambiguous situations, and is how many SUBs currently function. The two functions that violate that requirement are INSTR() and _INSTRREV(), which use the format `[?],?,?` and allow omitting the comma for the first argument. This format is simply handled as a special case. Fixes: #303
36 lines
993 B
Text
36 lines
993 B
Text
Test 1 , Args: 2
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
|
|
Test 2 , Args: 2@,@3
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
|
|
Test 3 , Args: 2@,@foo@(@3@,@2@)
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
|
|
Test 4 , Args: 2@,@3@,
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
|
|
Test 5 , Args: 2@,@,@3
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
|
|
Test 6 , Args: 2@,@,
|
|
Expected:-1 , Actual-1 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|
|
Expected: 0 , Actual 0 PASS!
|