mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 23:08:40 +02:00
Add the "catch()" built-in function.
This commit is contained in:
@@ -16254,6 +16254,38 @@ REM MSG D'oh, a file whose name has spaces! [filename()]
|
||||
D'oh, a file whose name has spaces! ../tests/with space.rem
|
||||
|
||||
|
||||
DEBUG +x
|
||||
# Test catch() built-in function
|
||||
set a catch(4/2, 33)
|
||||
4 / 2 => 2
|
||||
catch(2, ?) => 2
|
||||
set a catch(4/0, 33)
|
||||
4 / 0 => Division by zero
|
||||
catch(*Division by zero*, 33) => 33
|
||||
set a catch(4/0, 1/0)
|
||||
4 / 0 => Division by zero
|
||||
1 / 0 => Division by zero
|
||||
../tests/test.rem(1444): `/': Division by zero
|
||||
catch(*Division by zero*, *Division by zero*) => Division by zero
|
||||
set a catch(catch(4/0, 1/0), 39)
|
||||
4 / 0 => Division by zero
|
||||
1 / 0 => Division by zero
|
||||
catch(*Division by zero*, *Division by zero*) => Division by zero
|
||||
catch(*Division by zero*, 39) => 39
|
||||
set a catch(4/0, catch(4/0, 39))
|
||||
4 / 0 => Division by zero
|
||||
4 / 0 => Division by zero
|
||||
catch(*Division by zero*, 39) => 39
|
||||
catch(*Division by zero*, 39) => 39
|
||||
set a catch(1/0, catch("f" * "g", catch($IntMin*88, 42)))
|
||||
1 / 0 => Division by zero
|
||||
"f" * "g" => Type mismatch
|
||||
$IntMin => -2147483648
|
||||
-2147483648 * 88 => Number too high
|
||||
catch(*Number too high*, 42) => 42
|
||||
catch(*Type mismatch*, 42) => 42
|
||||
catch(*Division by zero*, 42) => 42
|
||||
DEBUG -x
|
||||
DEBUG -e
|
||||
Variable hash table statistics:
|
||||
Entries: 100141; Buckets: 87719; Non-empty Buckets: 66299
|
||||
@@ -16272,9 +16304,9 @@ Translation hash table statistics:
|
||||
Maxlen: 1; Minlen: 0; Avglen: 0.143; Stddev: 0.350; Avg nonempty len: 1.000
|
||||
Growths: 0; Shrinks: 0
|
||||
Expression nodes allocated: 300288
|
||||
Expression nodes high-water: 300073
|
||||
Expression nodes high-water: 300081
|
||||
Expression nodes leaked: 0
|
||||
Parse level high-water: 25
|
||||
Parse level high-water: 34
|
||||
|
||||
Test 2
|
||||
|
||||
@@ -24077,6 +24109,7 @@ ansicolor
|
||||
args
|
||||
asc
|
||||
baseyr
|
||||
catch
|
||||
char
|
||||
choose
|
||||
coerce
|
||||
|
||||
@@ -1437,6 +1437,15 @@ ENDIF
|
||||
|
||||
do "with space.rem"
|
||||
|
||||
DEBUG +x
|
||||
# Test catch() built-in function
|
||||
set a catch(4/2, 33)
|
||||
set a catch(4/0, 33)
|
||||
set a catch(4/0, 1/0)
|
||||
set a catch(catch(4/0, 1/0), 39)
|
||||
set a catch(4/0, catch(4/0, 39))
|
||||
set a catch(1/0, catch("f" * "g", catch($IntMin*88, 42)))
|
||||
DEBUG -x
|
||||
DEBUG -e
|
||||
|
||||
# Output expression-node stats
|
||||
|
||||
Reference in New Issue
Block a user