Skip to content

Commit

Permalink
[json] fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Jun 26, 2018
1 parent 4e2a84b commit 923e9cc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/vs/base/test/common/json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ function assertInvalidParse(input: string, expected: any, options?: ParseOptions
assert.deepEqual(actual, expected);
}

function assertTree(input: string, expected: any, expectedErrors: number[] = []): void {
function assertTree(input: string, expected: any, expectedErrors: number[] = [], options?: ParseOptions): void {
var errors: ParseError[] = [];
var actual = parseTree(input, errors);
var actual = parseTree(input, errors, options);

assert.deepEqual(errors.map(e => e.error, expected), expectedErrors);
let checkParent = (node: Node) => {
Expand Down Expand Up @@ -203,7 +203,7 @@ suite('JSON', () => {

test('parse: objects with errors', () => {
assertInvalidParse('{,}', {});
assertInvalidParse('{ "foo": true, }', { foo: true });
assertInvalidParse('{ "foo": true, }', { foo: true }, { disallowTrailingComma: true });
assertInvalidParse('{ "bar": 8 "xoo": "foo" }', { bar: 8, xoo: 'foo' });
assertInvalidParse('{ ,"bar": 8 }', { bar: 8 });
assertInvalidParse('{ ,"bar": 8, "foo" }', { bar: 8 });
Expand All @@ -213,10 +213,10 @@ suite('JSON', () => {

test('parse: array with errors', () => {
assertInvalidParse('[,]', []);
assertInvalidParse('[ 1, 2, ]', [1, 2]);
assertInvalidParse('[ 1, 2, ]', [1, 2], { disallowTrailingComma: true });
assertInvalidParse('[ 1 2, 3 ]', [1, 2, 3]);
assertInvalidParse('[ ,1, 2, 3 ]', [1, 2, 3]);
assertInvalidParse('[ ,1, 2, 3, ]', [1, 2, 3]);
assertInvalidParse('[ ,1, 2, 3, ]', [1, 2, 3], { disallowTrailingComma: true });
});

test('parse: disallow commments', () => {
Expand Down Expand Up @@ -324,6 +324,6 @@ suite('JSON', () => {
}
]
}
, [ParseErrorCode.PropertyNameExpected, ParseErrorCode.ValueExpected]);
, [ParseErrorCode.PropertyNameExpected, ParseErrorCode.ValueExpected], { disallowTrailingComma: true });
});
});

0 comments on commit 923e9cc

Please sign in to comment.