Skip to content

Commit bbd5361

Browse files
authored
fix: fix arg arity error message for index-of and slice (#1216)
1 parent 9b22917 commit bbd5361

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

src/expression/definitions/index_of.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class IndexOf implements Expression {
3131

3232
static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {
3333
if (args.length <= 2 || args.length >= 5) {
34-
return context.error(`Expected 3 or 4 arguments, but found ${args.length - 1} instead.`) as null;
34+
return context.error(`Expected 2 or 3 arguments, but found ${args.length - 1} instead.`) as null;
3535
}
3636

3737
const needle = context.parse(args[1], 1, ValueType);

src/expression/definitions/slice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class Slice implements Expression {
3131

3232
static parse(args: ReadonlyArray<unknown>, context: ParsingContext): Expression {
3333
if (args.length <= 2 || args.length >= 5) {
34-
return context.error(`Expected 3 or 4 arguments, but found ${args.length - 1} instead.`) as null;
34+
return context.error(`Expected 2 or 3 arguments, but found ${args.length - 1} instead.`) as null;
3535
}
3636

3737
const input = context.parse(args[1], 1, ValueType);

test/integration/expression/tests/index-of/missing-haystack/test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"errors": [
1010
{
1111
"key": "",
12-
"error": "Expected 3 or 4 arguments, but found 1 instead."
12+
"error": "Expected 2 or 3 arguments, but found 1 instead."
1313
}
1414
]
1515
}

test/integration/expression/tests/index-of/missing-needle/test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"errors": [
99
{
1010
"key": "",
11-
"error": "Expected 3 or 4 arguments, but found 0 instead."
11+
"error": "Expected 2 or 3 arguments, but found 0 instead."
1212
}
1313
]
1414
}

test/integration/expression/tests/index-of/unexpected-fourth-arg/test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"errors": [
1313
{
1414
"key": "",
15-
"error": "Expected 3 or 4 arguments, but found 4 instead."
15+
"error": "Expected 2 or 3 arguments, but found 4 instead."
1616
}
1717
]
1818
}

test/integration/expression/tests/slice/missing-input-arg/test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"errors": [
99
{
1010
"key": "",
11-
"error": "Expected 3 or 4 arguments, but found 0 instead."
11+
"error": "Expected 2 or 3 arguments, but found 0 instead."
1212
}
1313
]
1414
}

test/integration/expression/tests/slice/missing-start-index-arg/test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"errors": [
1010
{
1111
"key": "",
12-
"error": "Expected 3 or 4 arguments, but found 1 instead."
12+
"error": "Expected 2 or 3 arguments, but found 1 instead."
1313
}
1414
]
1515
}

test/integration/expression/tests/slice/unexpected-fourth-arg/test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"errors": [
1313
{
1414
"key": "",
15-
"error": "Expected 3 or 4 arguments, but found 4 instead."
15+
"error": "Expected 2 or 3 arguments, but found 4 instead."
1616
}
1717
]
1818
}

0 commit comments

Comments
 (0)