@mojir/lits 2.1.34 → 2.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -99
- package/dist/cli/cli.js +69 -69
- package/dist/index.esm.js +68 -68
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +68 -68
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +68 -68
- package/dist/lits.iife.js.map +1 -1
- package/dist/testFramework.esm.js +68 -68
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +68 -68
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -92,7 +92,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
92
92
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
var version = "2.1.
|
|
95
|
+
var version = "2.1.35";
|
|
96
96
|
|
|
97
97
|
function getCodeMarker(sourceCodeInfo) {
|
|
98
98
|
if (!sourceCodeInfo.position || !sourceCodeInfo.code)
|
|
@@ -14603,8 +14603,7 @@ var Parser = /** @class */ (function () {
|
|
|
14603
14603
|
};
|
|
14604
14604
|
Parser.prototype.parseTry = function (token) {
|
|
14605
14605
|
this.advance();
|
|
14606
|
-
var tryExpression = this.
|
|
14607
|
-
assertReservedSymbolToken(this.peek(), 'catch');
|
|
14606
|
+
var tryExpression = this.parseImplicitBlock(['catch']);
|
|
14608
14607
|
this.advance();
|
|
14609
14608
|
var errorSymbol;
|
|
14610
14609
|
if (isLParenToken(this.peek())) {
|
|
@@ -14613,7 +14612,8 @@ var Parser = /** @class */ (function () {
|
|
|
14613
14612
|
assertRParenToken(this.peek());
|
|
14614
14613
|
this.advance();
|
|
14615
14614
|
}
|
|
14616
|
-
var catchExpression = this.
|
|
14615
|
+
var catchExpression = this.parseImplicitBlock(['end']);
|
|
14616
|
+
this.advance();
|
|
14617
14617
|
return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.try, tryExpression, errorSymbol, catchExpression]], token[2]);
|
|
14618
14618
|
};
|
|
14619
14619
|
Parser.prototype.parseForOrDoseq = function (firstToken) {
|
|
@@ -15721,7 +15721,7 @@ var assertReference = {
|
|
|
15721
15721
|
{ argumentNames: ['value', 'message'] },
|
|
15722
15722
|
],
|
|
15723
15723
|
description: 'If $value is falsy it throws `AssertionError` with $message. If no $message is provided, message is set to $value.',
|
|
15724
|
-
examples: ['try
|
|
15724
|
+
examples: ['try assert(0, "Expected a positive value") catch (e) e.message end'],
|
|
15725
15725
|
noOperatorDocumentation: true,
|
|
15726
15726
|
},
|
|
15727
15727
|
'assert!=': {
|
|
@@ -15739,10 +15739,10 @@ var assertReference = {
|
|
|
15739
15739
|
],
|
|
15740
15740
|
description: 'If $a is the same as $b it throws `AssertionError`.',
|
|
15741
15741
|
examples: [
|
|
15742
|
-
'try
|
|
15743
|
-
'try
|
|
15744
|
-
'try
|
|
15745
|
-
'try
|
|
15742
|
+
'try assert!=(0, 0, "Expected different values") catch (e) e.message end',
|
|
15743
|
+
'try assert!=(0, 0) catch (e) e.message end',
|
|
15744
|
+
'try 0 assert!= 0 catch (e) e.message end',
|
|
15745
|
+
'try assert!=(0, 1) catch (e) e.message end',
|
|
15746
15746
|
],
|
|
15747
15747
|
noOperatorDocumentation: true,
|
|
15748
15748
|
},
|
|
@@ -15761,9 +15761,9 @@ var assertReference = {
|
|
|
15761
15761
|
],
|
|
15762
15762
|
description: 'If $a is not structural equal to $b it throws `AssertionError`.',
|
|
15763
15763
|
examples: [
|
|
15764
|
-
'try
|
|
15765
|
-
'try
|
|
15766
|
-
'try
|
|
15764
|
+
'try assert=({ "a": 1 }, { "a": 2 }, "Expected equal values") catch (e) e.message end',
|
|
15765
|
+
'try assert=({ "a": 1 }, { "a": 2 }) catch (e) e.message end',
|
|
15766
|
+
'try assert=({ "a": 1 }, { "a": 1 }) catch (e) e.message end',
|
|
15767
15767
|
],
|
|
15768
15768
|
noOperatorDocumentation: true,
|
|
15769
15769
|
},
|
|
@@ -15782,9 +15782,9 @@ var assertReference = {
|
|
|
15782
15782
|
],
|
|
15783
15783
|
description: 'If $a is not greater than $b it throws `AssertionError`.',
|
|
15784
15784
|
examples: [
|
|
15785
|
-
'try
|
|
15786
|
-
'try
|
|
15787
|
-
'try
|
|
15785
|
+
'try assert-gt(0, 1, "Expected greater value") catch (e) e.message end',
|
|
15786
|
+
'try assert-gt(0, 0) catch (e) e.message end',
|
|
15787
|
+
'try assert-gt(1, 0) catch (e) e.message end',
|
|
15788
15788
|
],
|
|
15789
15789
|
noOperatorDocumentation: true,
|
|
15790
15790
|
},
|
|
@@ -15803,9 +15803,9 @@ var assertReference = {
|
|
|
15803
15803
|
],
|
|
15804
15804
|
description: 'If $a is not less than $b it throws `AssertionError`.',
|
|
15805
15805
|
examples: [
|
|
15806
|
-
'try
|
|
15807
|
-
'try
|
|
15808
|
-
'try
|
|
15806
|
+
'try assert-lte(1, 0, "Expected smaller value value") catch (e) e.message end',
|
|
15807
|
+
'try assert-lte(1, 1) catch (e) e.message end',
|
|
15808
|
+
'try assert-lte(0, 1) catch (e) e.message end',
|
|
15809
15809
|
],
|
|
15810
15810
|
noOperatorDocumentation: true,
|
|
15811
15811
|
},
|
|
@@ -15824,9 +15824,9 @@ var assertReference = {
|
|
|
15824
15824
|
],
|
|
15825
15825
|
description: 'If $a is less than $b it throws `AssertionError`.',
|
|
15826
15826
|
examples: [
|
|
15827
|
-
'try
|
|
15828
|
-
'try
|
|
15829
|
-
'try
|
|
15827
|
+
'try assert-gte(0, 1, "Expected greater value") catch (e) e.message end',
|
|
15828
|
+
'try assert-gte(0, 1) catch (e) e.message end',
|
|
15829
|
+
'try assert-gte(1, 1) catch (e) e.message end',
|
|
15830
15830
|
],
|
|
15831
15831
|
noOperatorDocumentation: true,
|
|
15832
15832
|
},
|
|
@@ -15845,9 +15845,9 @@ var assertReference = {
|
|
|
15845
15845
|
],
|
|
15846
15846
|
description: 'If $a is grater than $b it throws `AssertionError`.',
|
|
15847
15847
|
examples: [
|
|
15848
|
-
'try
|
|
15849
|
-
'try
|
|
15850
|
-
'try
|
|
15848
|
+
'try assert-lte(1, 0, "Expected smaller value value") catch (e) e.message end',
|
|
15849
|
+
'try assert-lte(1, 0) catch (e) e.message end',
|
|
15850
|
+
'try assert-lte(1, 1) catch (e) e.message end',
|
|
15851
15851
|
],
|
|
15852
15852
|
noOperatorDocumentation: true,
|
|
15853
15853
|
},
|
|
@@ -15871,9 +15871,9 @@ var assertReference = {
|
|
|
15871
15871
|
],
|
|
15872
15872
|
description: 'If $value is not `true` it throws `AssertionError`.',
|
|
15873
15873
|
examples: [
|
|
15874
|
-
'try
|
|
15875
|
-
'try
|
|
15876
|
-
'try
|
|
15874
|
+
'try assert-true(false, "Expected true") catch (e) e.message end',
|
|
15875
|
+
'try assert-true(false) catch (e) e.message end',
|
|
15876
|
+
'try assert-true(true) catch (e) e.message end',
|
|
15877
15877
|
],
|
|
15878
15878
|
noOperatorDocumentation: true,
|
|
15879
15879
|
},
|
|
@@ -15897,9 +15897,9 @@ var assertReference = {
|
|
|
15897
15897
|
],
|
|
15898
15898
|
description: 'If $value is not `false` it throws `AssertionError`.',
|
|
15899
15899
|
examples: [
|
|
15900
|
-
'try
|
|
15901
|
-
'try
|
|
15902
|
-
'try
|
|
15900
|
+
'try assert-false(true, "Expected false") catch (e) e.message end',
|
|
15901
|
+
'try assert-false(true) catch (e) e.message end',
|
|
15902
|
+
'try assert-false(false) catch (e) e.message end',
|
|
15903
15903
|
],
|
|
15904
15904
|
noOperatorDocumentation: true,
|
|
15905
15905
|
},
|
|
@@ -15923,16 +15923,16 @@ var assertReference = {
|
|
|
15923
15923
|
],
|
|
15924
15924
|
description: 'If $value is not `truthy` it throws `AssertionError`.',
|
|
15925
15925
|
examples: [
|
|
15926
|
-
'try
|
|
15927
|
-
'try
|
|
15928
|
-
'try
|
|
15929
|
-
'try
|
|
15930
|
-
'try
|
|
15931
|
-
'try
|
|
15932
|
-
'try
|
|
15933
|
-
'try
|
|
15934
|
-
'try
|
|
15935
|
-
'try
|
|
15926
|
+
'try assert-truthy(false, "Expected truthy") catch (e) e.message end',
|
|
15927
|
+
'try assert-truthy(false) catch (e) e.message end',
|
|
15928
|
+
'try assert-truthy(0) catch (e) e.message end',
|
|
15929
|
+
'try assert-truthy(null) catch (e) e.message end',
|
|
15930
|
+
'try assert-truthy("") catch (e) e.message end',
|
|
15931
|
+
'try assert-truthy(true) catch (e) e.message end',
|
|
15932
|
+
'try assert-truthy(1) catch (e) e.message end',
|
|
15933
|
+
'try assert-truthy("x") catch (e) e.message end',
|
|
15934
|
+
'try assert-truthy([]) catch (e) e.message end',
|
|
15935
|
+
'try assert-truthy(nd) catch (e) e.message end',
|
|
15936
15936
|
],
|
|
15937
15937
|
noOperatorDocumentation: true,
|
|
15938
15938
|
},
|
|
@@ -15956,15 +15956,15 @@ var assertReference = {
|
|
|
15956
15956
|
],
|
|
15957
15957
|
description: 'If $value is not `falsy` it throws `AssertionError`.',
|
|
15958
15958
|
examples: [
|
|
15959
|
-
'try
|
|
15960
|
-
'try
|
|
15961
|
-
'try
|
|
15962
|
-
'try
|
|
15963
|
-
'try
|
|
15964
|
-
'try
|
|
15965
|
-
'try
|
|
15966
|
-
'try
|
|
15967
|
-
'try
|
|
15959
|
+
'try assert-falsy(true, "Expected falsy") catch (e) e.message end',
|
|
15960
|
+
'try assert-falsy("x") catch (e) e.message end',
|
|
15961
|
+
'try assert-falsy([]) catch (e) e.message end',
|
|
15962
|
+
'try assert-falsy(nd) catch (e) e.message end',
|
|
15963
|
+
'try assert-falsy(1) catch (e) e.message end',
|
|
15964
|
+
'try assert-falsy(false) catch (e) e.message end',
|
|
15965
|
+
'try assert-falsy(0) catch (e) e.message end',
|
|
15966
|
+
'try assert-falsy(null) catch (e) e.message end',
|
|
15967
|
+
'try assert-falsy("") catch (e) e.message end',
|
|
15968
15968
|
],
|
|
15969
15969
|
noOperatorDocumentation: true,
|
|
15970
15970
|
},
|
|
@@ -15988,15 +15988,15 @@ var assertReference = {
|
|
|
15988
15988
|
],
|
|
15989
15989
|
description: 'If $value is not `null` it throws `AssertionError`.',
|
|
15990
15990
|
examples: [
|
|
15991
|
-
'try
|
|
15992
|
-
'try
|
|
15993
|
-
'try
|
|
15994
|
-
'try
|
|
15995
|
-
'try
|
|
15996
|
-
'try
|
|
15997
|
-
'try
|
|
15998
|
-
'try
|
|
15999
|
-
'try
|
|
15991
|
+
'try assert-null(null) catch (e) e.message end',
|
|
15992
|
+
'try assert-null(true, "Expected null") catch (e) e.message end',
|
|
15993
|
+
'try assert-null("x") catch (e) e.message end',
|
|
15994
|
+
'try assert-null([]) catch (e) e.message end',
|
|
15995
|
+
'try assert-null(nd) catch (e) e.message end',
|
|
15996
|
+
'try assert-null(1) catch (e) e.message end',
|
|
15997
|
+
'try assert-null(false) catch (e) e.message end',
|
|
15998
|
+
'try assert-null(0) catch (e) e.message end',
|
|
15999
|
+
'try assert-null("") catch (e) e.message end',
|
|
16000
16000
|
],
|
|
16001
16001
|
noOperatorDocumentation: true,
|
|
16002
16002
|
},
|
|
@@ -16021,7 +16021,7 @@ var assertReference = {
|
|
|
16021
16021
|
description: 'If $fun does not throw, it throws `AssertionError`.',
|
|
16022
16022
|
examples: [
|
|
16023
16023
|
'assert-throws(-> throw("Error"))',
|
|
16024
|
-
'try
|
|
16024
|
+
'try assert-throws(-> identity("Error")) catch (e) e.message end',
|
|
16025
16025
|
],
|
|
16026
16026
|
noOperatorDocumentation: true,
|
|
16027
16027
|
},
|
|
@@ -16048,8 +16048,8 @@ var assertReference = {
|
|
|
16048
16048
|
],
|
|
16049
16049
|
description: 'If $fun does not throw $error-message, it throws `AssertionError`.',
|
|
16050
16050
|
examples: [
|
|
16051
|
-
'try
|
|
16052
|
-
'try
|
|
16051
|
+
'try assert-throws-error(-> throw("Error"), "Error") catch (e) e.message end',
|
|
16052
|
+
'try assert-throws-error(-> identity("Error"), "Error") catch (e) e.message end',
|
|
16053
16053
|
],
|
|
16054
16054
|
noOperatorDocumentation: true,
|
|
16055
16055
|
},
|
|
@@ -16073,8 +16073,8 @@ var assertReference = {
|
|
|
16073
16073
|
],
|
|
16074
16074
|
description: 'If $fun throws, it throws `AssertionError`.',
|
|
16075
16075
|
examples: [
|
|
16076
|
-
'try
|
|
16077
|
-
'try
|
|
16076
|
+
'try assert-not-throws(-> identity("Error")) catch (e) e.message end',
|
|
16077
|
+
'try assert-not-throws(-> throw("Error")) catch (e) e.message end',
|
|
16078
16078
|
],
|
|
16079
16079
|
noOperatorDocumentation: true,
|
|
16080
16080
|
},
|
|
@@ -26765,9 +26765,9 @@ var specialExpressionsReference = {
|
|
|
26765
26765
|
],
|
|
26766
26766
|
description: 'Executes `try-body`. If that throws, the `catch-body` gets executed. See examples for details.',
|
|
26767
26767
|
examples: [
|
|
26768
|
-
"\ntry
|
|
26769
|
-
"\ntry
|
|
26770
|
-
"\ntry
|
|
26768
|
+
"\ntry\n 2 / 4\ncatch\n \"Oops!\"\nend",
|
|
26769
|
+
"\ntry\n foo()\ncatch(error)\n \"Error: \" ++ error.message\nend",
|
|
26770
|
+
"\ntry\n foo()\ncatch\n 42\nend",
|
|
26771
26771
|
],
|
|
26772
26772
|
},
|
|
26773
26773
|
'throw': {
|
|
@@ -26786,8 +26786,8 @@ var specialExpressionsReference = {
|
|
|
26786
26786
|
],
|
|
26787
26787
|
description: 'Throws `UserDefinedError` with message set to $expr evaluated. $expr must evaluate to a string.',
|
|
26788
26788
|
examples: [
|
|
26789
|
-
'try
|
|
26790
|
-
'try
|
|
26789
|
+
'try throw("You shall not pass!") catch(error) "Error: " ++ error.message end',
|
|
26790
|
+
'try throw(slice("You shall not pass!", 0, 3)) catch(error) "Error: " ++ error.message end',
|
|
26791
26791
|
],
|
|
26792
26792
|
},
|
|
26793
26793
|
'if': {
|
|
@@ -30933,7 +30933,7 @@ var datatype = {
|
|
|
30933
30933
|
title: 'never',
|
|
30934
30934
|
category: 'Datatype',
|
|
30935
30935
|
description: 'A value that can never be created',
|
|
30936
|
-
examples: ["\n// throw(\"error\") will never return a value\ntry
|
|
30936
|
+
examples: ["\n// throw(\"error\") will never return a value\ntry throw(\"error\") catch \"never\" end",
|
|
30937
30937
|
],
|
|
30938
30938
|
},
|
|
30939
30939
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -14629,8 +14629,7 @@ var Parser = /** @class */ (function () {
|
|
|
14629
14629
|
};
|
|
14630
14630
|
Parser.prototype.parseTry = function (token) {
|
|
14631
14631
|
this.advance();
|
|
14632
|
-
var tryExpression = this.
|
|
14633
|
-
assertReservedSymbolToken(this.peek(), 'catch');
|
|
14632
|
+
var tryExpression = this.parseImplicitBlock(['catch']);
|
|
14634
14633
|
this.advance();
|
|
14635
14634
|
var errorSymbol;
|
|
14636
14635
|
if (isLParenToken(this.peek())) {
|
|
@@ -14639,7 +14638,8 @@ var Parser = /** @class */ (function () {
|
|
|
14639
14638
|
assertRParenToken(this.peek());
|
|
14640
14639
|
this.advance();
|
|
14641
14640
|
}
|
|
14642
|
-
var catchExpression = this.
|
|
14641
|
+
var catchExpression = this.parseImplicitBlock(['end']);
|
|
14642
|
+
this.advance();
|
|
14643
14643
|
return withSourceCodeInfo([NodeTypes.SpecialExpression, [specialExpressionTypes.try, tryExpression, errorSymbol, catchExpression]], token[2]);
|
|
14644
14644
|
};
|
|
14645
14645
|
Parser.prototype.parseForOrDoseq = function (firstToken) {
|
|
@@ -15768,7 +15768,7 @@ var assertReference = {
|
|
|
15768
15768
|
{ argumentNames: ['value', 'message'] },
|
|
15769
15769
|
],
|
|
15770
15770
|
description: 'If $value is falsy it throws `AssertionError` with $message. If no $message is provided, message is set to $value.',
|
|
15771
|
-
examples: ['try
|
|
15771
|
+
examples: ['try assert(0, "Expected a positive value") catch (e) e.message end'],
|
|
15772
15772
|
noOperatorDocumentation: true,
|
|
15773
15773
|
},
|
|
15774
15774
|
'assert!=': {
|
|
@@ -15786,10 +15786,10 @@ var assertReference = {
|
|
|
15786
15786
|
],
|
|
15787
15787
|
description: 'If $a is the same as $b it throws `AssertionError`.',
|
|
15788
15788
|
examples: [
|
|
15789
|
-
'try
|
|
15790
|
-
'try
|
|
15791
|
-
'try
|
|
15792
|
-
'try
|
|
15789
|
+
'try assert!=(0, 0, "Expected different values") catch (e) e.message end',
|
|
15790
|
+
'try assert!=(0, 0) catch (e) e.message end',
|
|
15791
|
+
'try 0 assert!= 0 catch (e) e.message end',
|
|
15792
|
+
'try assert!=(0, 1) catch (e) e.message end',
|
|
15793
15793
|
],
|
|
15794
15794
|
noOperatorDocumentation: true,
|
|
15795
15795
|
},
|
|
@@ -15808,9 +15808,9 @@ var assertReference = {
|
|
|
15808
15808
|
],
|
|
15809
15809
|
description: 'If $a is not structural equal to $b it throws `AssertionError`.',
|
|
15810
15810
|
examples: [
|
|
15811
|
-
'try
|
|
15812
|
-
'try
|
|
15813
|
-
'try
|
|
15811
|
+
'try assert=({ "a": 1 }, { "a": 2 }, "Expected equal values") catch (e) e.message end',
|
|
15812
|
+
'try assert=({ "a": 1 }, { "a": 2 }) catch (e) e.message end',
|
|
15813
|
+
'try assert=({ "a": 1 }, { "a": 1 }) catch (e) e.message end',
|
|
15814
15814
|
],
|
|
15815
15815
|
noOperatorDocumentation: true,
|
|
15816
15816
|
},
|
|
@@ -15829,9 +15829,9 @@ var assertReference = {
|
|
|
15829
15829
|
],
|
|
15830
15830
|
description: 'If $a is not greater than $b it throws `AssertionError`.',
|
|
15831
15831
|
examples: [
|
|
15832
|
-
'try
|
|
15833
|
-
'try
|
|
15834
|
-
'try
|
|
15832
|
+
'try assert-gt(0, 1, "Expected greater value") catch (e) e.message end',
|
|
15833
|
+
'try assert-gt(0, 0) catch (e) e.message end',
|
|
15834
|
+
'try assert-gt(1, 0) catch (e) e.message end',
|
|
15835
15835
|
],
|
|
15836
15836
|
noOperatorDocumentation: true,
|
|
15837
15837
|
},
|
|
@@ -15850,9 +15850,9 @@ var assertReference = {
|
|
|
15850
15850
|
],
|
|
15851
15851
|
description: 'If $a is not less than $b it throws `AssertionError`.',
|
|
15852
15852
|
examples: [
|
|
15853
|
-
'try
|
|
15854
|
-
'try
|
|
15855
|
-
'try
|
|
15853
|
+
'try assert-lte(1, 0, "Expected smaller value value") catch (e) e.message end',
|
|
15854
|
+
'try assert-lte(1, 1) catch (e) e.message end',
|
|
15855
|
+
'try assert-lte(0, 1) catch (e) e.message end',
|
|
15856
15856
|
],
|
|
15857
15857
|
noOperatorDocumentation: true,
|
|
15858
15858
|
},
|
|
@@ -15871,9 +15871,9 @@ var assertReference = {
|
|
|
15871
15871
|
],
|
|
15872
15872
|
description: 'If $a is less than $b it throws `AssertionError`.',
|
|
15873
15873
|
examples: [
|
|
15874
|
-
'try
|
|
15875
|
-
'try
|
|
15876
|
-
'try
|
|
15874
|
+
'try assert-gte(0, 1, "Expected greater value") catch (e) e.message end',
|
|
15875
|
+
'try assert-gte(0, 1) catch (e) e.message end',
|
|
15876
|
+
'try assert-gte(1, 1) catch (e) e.message end',
|
|
15877
15877
|
],
|
|
15878
15878
|
noOperatorDocumentation: true,
|
|
15879
15879
|
},
|
|
@@ -15892,9 +15892,9 @@ var assertReference = {
|
|
|
15892
15892
|
],
|
|
15893
15893
|
description: 'If $a is grater than $b it throws `AssertionError`.',
|
|
15894
15894
|
examples: [
|
|
15895
|
-
'try
|
|
15896
|
-
'try
|
|
15897
|
-
'try
|
|
15895
|
+
'try assert-lte(1, 0, "Expected smaller value value") catch (e) e.message end',
|
|
15896
|
+
'try assert-lte(1, 0) catch (e) e.message end',
|
|
15897
|
+
'try assert-lte(1, 1) catch (e) e.message end',
|
|
15898
15898
|
],
|
|
15899
15899
|
noOperatorDocumentation: true,
|
|
15900
15900
|
},
|
|
@@ -15918,9 +15918,9 @@ var assertReference = {
|
|
|
15918
15918
|
],
|
|
15919
15919
|
description: 'If $value is not `true` it throws `AssertionError`.',
|
|
15920
15920
|
examples: [
|
|
15921
|
-
'try
|
|
15922
|
-
'try
|
|
15923
|
-
'try
|
|
15921
|
+
'try assert-true(false, "Expected true") catch (e) e.message end',
|
|
15922
|
+
'try assert-true(false) catch (e) e.message end',
|
|
15923
|
+
'try assert-true(true) catch (e) e.message end',
|
|
15924
15924
|
],
|
|
15925
15925
|
noOperatorDocumentation: true,
|
|
15926
15926
|
},
|
|
@@ -15944,9 +15944,9 @@ var assertReference = {
|
|
|
15944
15944
|
],
|
|
15945
15945
|
description: 'If $value is not `false` it throws `AssertionError`.',
|
|
15946
15946
|
examples: [
|
|
15947
|
-
'try
|
|
15948
|
-
'try
|
|
15949
|
-
'try
|
|
15947
|
+
'try assert-false(true, "Expected false") catch (e) e.message end',
|
|
15948
|
+
'try assert-false(true) catch (e) e.message end',
|
|
15949
|
+
'try assert-false(false) catch (e) e.message end',
|
|
15950
15950
|
],
|
|
15951
15951
|
noOperatorDocumentation: true,
|
|
15952
15952
|
},
|
|
@@ -15970,16 +15970,16 @@ var assertReference = {
|
|
|
15970
15970
|
],
|
|
15971
15971
|
description: 'If $value is not `truthy` it throws `AssertionError`.',
|
|
15972
15972
|
examples: [
|
|
15973
|
-
'try
|
|
15974
|
-
'try
|
|
15975
|
-
'try
|
|
15976
|
-
'try
|
|
15977
|
-
'try
|
|
15978
|
-
'try
|
|
15979
|
-
'try
|
|
15980
|
-
'try
|
|
15981
|
-
'try
|
|
15982
|
-
'try
|
|
15973
|
+
'try assert-truthy(false, "Expected truthy") catch (e) e.message end',
|
|
15974
|
+
'try assert-truthy(false) catch (e) e.message end',
|
|
15975
|
+
'try assert-truthy(0) catch (e) e.message end',
|
|
15976
|
+
'try assert-truthy(null) catch (e) e.message end',
|
|
15977
|
+
'try assert-truthy("") catch (e) e.message end',
|
|
15978
|
+
'try assert-truthy(true) catch (e) e.message end',
|
|
15979
|
+
'try assert-truthy(1) catch (e) e.message end',
|
|
15980
|
+
'try assert-truthy("x") catch (e) e.message end',
|
|
15981
|
+
'try assert-truthy([]) catch (e) e.message end',
|
|
15982
|
+
'try assert-truthy(nd) catch (e) e.message end',
|
|
15983
15983
|
],
|
|
15984
15984
|
noOperatorDocumentation: true,
|
|
15985
15985
|
},
|
|
@@ -16003,15 +16003,15 @@ var assertReference = {
|
|
|
16003
16003
|
],
|
|
16004
16004
|
description: 'If $value is not `falsy` it throws `AssertionError`.',
|
|
16005
16005
|
examples: [
|
|
16006
|
-
'try
|
|
16007
|
-
'try
|
|
16008
|
-
'try
|
|
16009
|
-
'try
|
|
16010
|
-
'try
|
|
16011
|
-
'try
|
|
16012
|
-
'try
|
|
16013
|
-
'try
|
|
16014
|
-
'try
|
|
16006
|
+
'try assert-falsy(true, "Expected falsy") catch (e) e.message end',
|
|
16007
|
+
'try assert-falsy("x") catch (e) e.message end',
|
|
16008
|
+
'try assert-falsy([]) catch (e) e.message end',
|
|
16009
|
+
'try assert-falsy(nd) catch (e) e.message end',
|
|
16010
|
+
'try assert-falsy(1) catch (e) e.message end',
|
|
16011
|
+
'try assert-falsy(false) catch (e) e.message end',
|
|
16012
|
+
'try assert-falsy(0) catch (e) e.message end',
|
|
16013
|
+
'try assert-falsy(null) catch (e) e.message end',
|
|
16014
|
+
'try assert-falsy("") catch (e) e.message end',
|
|
16015
16015
|
],
|
|
16016
16016
|
noOperatorDocumentation: true,
|
|
16017
16017
|
},
|
|
@@ -16035,15 +16035,15 @@ var assertReference = {
|
|
|
16035
16035
|
],
|
|
16036
16036
|
description: 'If $value is not `null` it throws `AssertionError`.',
|
|
16037
16037
|
examples: [
|
|
16038
|
-
'try
|
|
16039
|
-
'try
|
|
16040
|
-
'try
|
|
16041
|
-
'try
|
|
16042
|
-
'try
|
|
16043
|
-
'try
|
|
16044
|
-
'try
|
|
16045
|
-
'try
|
|
16046
|
-
'try
|
|
16038
|
+
'try assert-null(null) catch (e) e.message end',
|
|
16039
|
+
'try assert-null(true, "Expected null") catch (e) e.message end',
|
|
16040
|
+
'try assert-null("x") catch (e) e.message end',
|
|
16041
|
+
'try assert-null([]) catch (e) e.message end',
|
|
16042
|
+
'try assert-null(nd) catch (e) e.message end',
|
|
16043
|
+
'try assert-null(1) catch (e) e.message end',
|
|
16044
|
+
'try assert-null(false) catch (e) e.message end',
|
|
16045
|
+
'try assert-null(0) catch (e) e.message end',
|
|
16046
|
+
'try assert-null("") catch (e) e.message end',
|
|
16047
16047
|
],
|
|
16048
16048
|
noOperatorDocumentation: true,
|
|
16049
16049
|
},
|
|
@@ -16068,7 +16068,7 @@ var assertReference = {
|
|
|
16068
16068
|
description: 'If $fun does not throw, it throws `AssertionError`.',
|
|
16069
16069
|
examples: [
|
|
16070
16070
|
'assert-throws(-> throw("Error"))',
|
|
16071
|
-
'try
|
|
16071
|
+
'try assert-throws(-> identity("Error")) catch (e) e.message end',
|
|
16072
16072
|
],
|
|
16073
16073
|
noOperatorDocumentation: true,
|
|
16074
16074
|
},
|
|
@@ -16095,8 +16095,8 @@ var assertReference = {
|
|
|
16095
16095
|
],
|
|
16096
16096
|
description: 'If $fun does not throw $error-message, it throws `AssertionError`.',
|
|
16097
16097
|
examples: [
|
|
16098
|
-
'try
|
|
16099
|
-
'try
|
|
16098
|
+
'try assert-throws-error(-> throw("Error"), "Error") catch (e) e.message end',
|
|
16099
|
+
'try assert-throws-error(-> identity("Error"), "Error") catch (e) e.message end',
|
|
16100
16100
|
],
|
|
16101
16101
|
noOperatorDocumentation: true,
|
|
16102
16102
|
},
|
|
@@ -16120,8 +16120,8 @@ var assertReference = {
|
|
|
16120
16120
|
],
|
|
16121
16121
|
description: 'If $fun throws, it throws `AssertionError`.',
|
|
16122
16122
|
examples: [
|
|
16123
|
-
'try
|
|
16124
|
-
'try
|
|
16123
|
+
'try assert-not-throws(-> identity("Error")) catch (e) e.message end',
|
|
16124
|
+
'try assert-not-throws(-> throw("Error")) catch (e) e.message end',
|
|
16125
16125
|
],
|
|
16126
16126
|
noOperatorDocumentation: true,
|
|
16127
16127
|
},
|
|
@@ -26812,9 +26812,9 @@ var specialExpressionsReference = {
|
|
|
26812
26812
|
],
|
|
26813
26813
|
description: 'Executes `try-body`. If that throws, the `catch-body` gets executed. See examples for details.',
|
|
26814
26814
|
examples: [
|
|
26815
|
-
"\ntry
|
|
26816
|
-
"\ntry
|
|
26817
|
-
"\ntry
|
|
26815
|
+
"\ntry\n 2 / 4\ncatch\n \"Oops!\"\nend",
|
|
26816
|
+
"\ntry\n foo()\ncatch(error)\n \"Error: \" ++ error.message\nend",
|
|
26817
|
+
"\ntry\n foo()\ncatch\n 42\nend",
|
|
26818
26818
|
],
|
|
26819
26819
|
},
|
|
26820
26820
|
'throw': {
|
|
@@ -26833,8 +26833,8 @@ var specialExpressionsReference = {
|
|
|
26833
26833
|
],
|
|
26834
26834
|
description: 'Throws `UserDefinedError` with message set to $expr evaluated. $expr must evaluate to a string.',
|
|
26835
26835
|
examples: [
|
|
26836
|
-
'try
|
|
26837
|
-
'try
|
|
26836
|
+
'try throw("You shall not pass!") catch(error) "Error: " ++ error.message end',
|
|
26837
|
+
'try throw(slice("You shall not pass!", 0, 3)) catch(error) "Error: " ++ error.message end',
|
|
26838
26838
|
],
|
|
26839
26839
|
},
|
|
26840
26840
|
'if': {
|
|
@@ -30980,7 +30980,7 @@ var datatype = {
|
|
|
30980
30980
|
title: 'never',
|
|
30981
30981
|
category: 'Datatype',
|
|
30982
30982
|
description: 'A value that can never be created',
|
|
30983
|
-
examples: ["\n// throw(\"error\") will never return a value\ntry
|
|
30983
|
+
examples: ["\n// throw(\"error\") will never return a value\ntry throw(\"error\") catch \"never\" end",
|
|
30984
30984
|
],
|
|
30985
30985
|
},
|
|
30986
30986
|
};
|