You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constexpectedError="Expected constant (please refer to documentation for allowed values) at the first parameter, but received "+input+" in p5.blendMode().";
71
+
constexpectedError="🌸 p5.js says: Expected constant (please refer to documentation for allowed values) at the first parameter, but received "+input+" in p5.blendMode().";
73
72
assert.equal(result.error,expectedError);
74
73
});
75
74
});
@@ -88,11 +87,11 @@ suite('Validate Params', function () {
88
87
});
89
88
90
89
constinvalidInputs=[
91
-
{name: 'missing required arc parameters #4, #5',input: [200,100,100,80],msg: 'Expected at least 6 arguments, but received fewer in p5.arc(). For more information, see https://p5js.org/reference/p5/arc.'},
92
-
{name: 'missing required param #0',input: [undefined,100,100,80,0,Math.PI,constants.PIE,30],msg: 'Expected number at the first parameter, but received undefined in p5.arc().'},
93
-
{name: 'missing required param #4',input: [200,100,100,80,undefined,0],msg: 'Expected number at the fifth parameter, but received undefined in p5.arc().'},
94
-
{name: 'missing optional param #5',input: [200,100,100,80,0,undefined,Math.PI],msg: 'Expected number at the sixth parameter, but received undefined in p5.arc().'},
95
-
{name: 'wrong param type at #0',input: ['a',100,100,80,0,Math.PI,constants.PIE,30],msg: 'Expected number at the first parameter, but received string in p5.arc().'}
90
+
{name: 'missing required arc parameters #4, #5',input: [200,100,100,80],msg: '🌸 p5.js says: Expected at least 6 arguments, but received fewer in p5.arc(). For more information, see https://p5js.org/reference/p5/arc.'},
91
+
{name: 'missing required param #0',input: [undefined,100,100,80,0,Math.PI,constants.PIE,30],msg: '🌸 p5.js says: Expected number at the first parameter, but received undefined in p5.arc().'},
92
+
{name: 'missing required param #4',input: [200,100,100,80,undefined,0],msg: '🌸 p5.js says: Expected number at the fifth parameter, but received undefined in p5.arc().'},
93
+
{name: 'missing optional param #5',input: [200,100,100,80,0,undefined,Math.PI],msg: '🌸 p5.js says: Expected number at the sixth parameter, but received undefined in p5.arc().'},
94
+
{name: 'wrong param type at #0',input: ['a',100,100,80,0,Math.PI,constants.PIE,30],msg: '🌸 p5.js says: Expected number at the first parameter, but received string in p5.arc().'}
96
95
];
97
96
98
97
invalidInputs.forEach(({ name, input, msg })=>{
@@ -112,13 +111,13 @@ suite('Validate Params', function () {
112
111
113
112
suite('validateParams: a few edge cases',function(){
114
113
constinvalidInputs=[
115
-
{fn: 'color',name: 'wrong type for optional parameter',input: [0,0,0,'A'],msg: 'Expected number at the fourth parameter, but received string in p5.color().'},
116
-
{fn: 'color',name: 'superfluous parameter',input: [[0,0,0],0],msg: 'Expected number at the first parameter, but received array in p5.color().'},
117
-
{fn: 'color',name: 'wrong element types',input: [['A','B','C']],msg: 'Expected number at the first parameter, but received array in p5.color().'},
118
-
{fn: 'rect',name: 'null, non-trailing, optional parameter',input: [0,0,0,0,null,0,0,0],msg: 'Expected number at the fifth parameter, but received null in p5.rect().'},
119
-
{fn: 'color',name: 'too many args + wrong types too',input: ['A','A',0,0,0,0,0,0,0,0],msg: 'Expected at most 4 arguments, but received more in p5.color(). For more information, see https://p5js.org/reference/p5/color.'},
120
-
{fn: 'line',name: 'null string given',input: [1,2,4,'null'],msg: 'Expected number at the fourth parameter, but received string in p5.line().'},
121
-
{fn: 'line',name: 'NaN value given',input: [1,2,4,NaN],msg: 'Expected number at the fourth parameter, but received nan in p5.line().'}
114
+
{fn: 'color',name: 'wrong type for optional parameter',input: [0,0,0,'A'],msg: '🌸 p5.js says: Expected number at the fourth parameter, but received string in p5.color().'},
115
+
{fn: 'color',name: 'superfluous parameter',input: [[0,0,0],0],msg: '🌸 p5.js says: Expected number at the first parameter, but received array in p5.color().'},
116
+
{fn: 'color',name: 'wrong element types',input: [['A','B','C']],msg: '🌸 p5.js says: Expected number at the first parameter, but received array in p5.color().'},
117
+
{fn: 'rect',name: 'null, non-trailing, optional parameter',input: [0,0,0,0,null,0,0,0],msg: '🌸 p5.js says: Expected number at the fifth parameter, but received null in p5.rect().'},
118
+
{fn: 'color',name: 'too many args + wrong types too',input: ['A','A',0,0,0,0,0,0,0,0],msg: '🌸 p5.js says: Expected at most 4 arguments, but received more in p5.color(). For more information, see https://p5js.org/reference/p5/color.'},
119
+
{fn: 'line',name: 'null string given',input: [1,2,4,'null'],msg: '🌸 p5.js says: Expected number at the fourth parameter, but received string in p5.line().'},
120
+
{fn: 'line',name: 'NaN value given',input: [1,2,4,NaN],msg: '🌸 p5.js says: Expected number at the fourth parameter, but received nan in p5.line().'}
{fn: 'color',name: 'missing params #1, #2',input: [12,undefined,undefined],msg: 'Expected number at the second parameter, but received undefined in p5.color().'},
133
+
{fn: 'color',name: 'missing params #1, #2',input: [12,undefined,undefined],msg: '🌸 p5.js says: Expected number at the second parameter, but received undefined in p5.color().'},
135
134
// Even though the undefined arguments are technically allowed for
136
135
// optional parameters, it is more likely that the user wanted to call
137
136
// the function with meaningful arguments.
138
-
{fn: 'random',name: 'missing params #0, #1',input: [undefined,undefined],msg: 'All arguments for p5.random() are undefined. There is likely an error in the code.'},
139
-
{fn: 'circle',name: 'missing compulsory parameter #2',input: [5,5,undefined],msg: 'Expected number at the third parameter, but received undefined in p5.circle().'}
137
+
{fn: 'random',name: 'missing params #0, #1',input: [undefined,undefined],msg: '🌸 p5.js says: All arguments for p5.random() are undefined. There is likely an error in the code.'},
138
+
{fn: 'circle',name: 'missing compulsory parameter #2',input: [5,5,undefined],msg: '🌸 p5.js says: Expected number at the third parameter, but received undefined in p5.circle().'}
@@ -161,10 +160,10 @@ suite('Validate Params', function () {
161
160
});
162
161
163
162
constinvalidInputs=[
164
-
{name: 'optional parameter, incorrect type',input: [65,100,100,'a'],msg: 'Expected number at the fourth parameter, but received string in p5.color().'},
165
-
{name: 'extra parameter',input: [[65,100,100],100],msg: 'Expected number at the first parameter, but received array in p5.color().'},
166
-
{name: 'incorrect element type',input: ['A','B','C'],msg: 'Expected number at the first parameter, but received string in p5.color().'},
167
-
{name: 'incorrect parameter count',input: ['A','A',0,0,0,0,0,0],msg: 'Expected at most 4 arguments, but received more in p5.color(). For more information, see https://p5js.org/reference/p5/color.'}
163
+
{name: 'optional parameter, incorrect type',input: [65,100,100,'a'],msg: '🌸 p5.js says: Expected number at the fourth parameter, but received string in p5.color().'},
164
+
{name: 'extra parameter',input: [[65,100,100],100],msg: '🌸 p5.js says: Expected number at the first parameter, but received array in p5.color().'},
165
+
{name: 'incorrect element type',input: ['A','B','C'],msg: '🌸 p5.js says: Expected number at the first parameter, but received string in p5.color().'},
166
+
{name: 'incorrect parameter count',input: ['A','A',0,0,0,0,0,0],msg: '🌸 p5.js says: Expected at most 4 arguments, but received more in p5.color(). For more information, see https://p5js.org/reference/p5/color.'}
168
167
];
169
168
170
169
invalidInputs.forEach(({ name, input, msg })=>{
@@ -191,7 +190,7 @@ suite('Validate Params', function () {
0 commit comments