-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds and adapts the official JSON5 parser tests. `test/todo/json5.js` should be moved to `test/node` as soon as we fix all the failures. PR-URL: #158 Refs: https://github.com/metarhia/JSTP/issues/152 Reviewed-By: Dmytro Nechai <nechaido@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
- Loading branch information
Showing
129 changed files
with
632 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules/ | |
dist/ | ||
site/ | ||
examples/data-formats/*.js | ||
test/fixtures/json5/**/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2012-2016 Aseem Kishore, and [others](https://github.com/json5/json5/contributors). | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
*Note*: this is forked from https://github.com/json5/json5-tests | ||
|
||
# Parse Test Cases for JSON5 | ||
|
||
The test cases' file extension signals the expected behavior: | ||
|
||
- Valid JSON should remain valid JSON5. These cases have a `.json` extension | ||
and are tested via `JSON.parse()`. | ||
|
||
- JSON5's new features should remain valid ES5. These cases have a `.json5` | ||
extension are tested via `eval()`. | ||
|
||
- Valid ES5 that's explicitly disallowed by JSON5 is also invalid JSON. These | ||
cases have a `.js` extension and are expected to fail. | ||
|
||
- Invalid ES5 should remain invalid JSON5. These cases have a `.txt` extension | ||
and are expected to fail. | ||
|
||
This should cover all our bases. Most of the cases are unit tests for each | ||
supported data type, but aggregate test cases are welcome, too. | ||
|
||
## License | ||
|
||
MIT. See [LICENSE.md](./LICENSE.md) for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
,null | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
at: 16, | ||
lineNumber: 3, | ||
columnNumber: 5, | ||
message: "Expected ']' instead of 'f'" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
true | ||
false | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
true, | ||
false, | ||
null | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
null, | ||
] |
6 changes: 6 additions & 0 deletions
6
test/fixtures/json5/comments/block-comment-following-array-element.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
false | ||
/* | ||
true | ||
*/ | ||
] |
5 changes: 5 additions & 0 deletions
5
test/fixtures/json5/comments/block-comment-following-top-level-value.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
null | ||
/* | ||
Some non-comment top-level value is needed; | ||
we use null above. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"This /* block comment */ isn't really a block comment." |
5 changes: 5 additions & 0 deletions
5
test/fixtures/json5/comments/block-comment-preceding-top-level-value.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* | ||
Some non-comment top-level value is needed; | ||
we use null below. | ||
*/ | ||
null |
7 changes: 7 additions & 0 deletions
7
test/fixtures/json5/comments/block-comment-with-asterisks.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* This is a JavaDoc-like block comment. | ||
* It contains asterisks inside of it. | ||
* It might also be closed with multiple asterisks. | ||
* Like this: | ||
**/ | ||
true |
3 changes: 3 additions & 0 deletions
3
test/fixtures/json5/comments/inline-comment-following-array-element.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
false // true | ||
] |
1 change: 1 addition & 0 deletions
1
test/fixtures/json5/comments/inline-comment-following-top-level-value.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
null // Some non-comment top-level value is needed; we use null here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"This inline comment // isn't really an inline comment." |
2 changes: 2 additions & 0 deletions
2
test/fixtures/json5/comments/inline-comment-preceding-top-level-value.json5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Some non-comment top-level value is needed; we use null below. | ||
null |
6 changes: 6 additions & 0 deletions
6
test/fixtures/json5/comments/top-level-block-comment.errorSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
at: 77, | ||
lineNumber: 4, | ||
columnNumber: 3, | ||
message: "Unexpected EOF" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
This should fail; | ||
comments cannot be the only top-level value. | ||
*/ |
6 changes: 6 additions & 0 deletions
6
test/fixtures/json5/comments/top-level-inline-comment.errorSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
at: 66, | ||
lineNumber: 1, | ||
columnNumber: 67, | ||
message: "Unexpected EOF" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// This should fail; comments cannot be the only top-level value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
true | ||
/* | ||
This block comment doesn't terminate. | ||
There was a legitimate value before this, | ||
but this is still invalid JS/JSON5. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"name": "npm", | ||
"publishConfig": { | ||
"proprietary-attribs": false | ||
}, | ||
"description": "A package manager for node", | ||
"keywords": [ | ||
"package manager", | ||
"modules", | ||
"install", | ||
"package.json" | ||
], | ||
"version": "1.1.22", | ||
"preferGlobal": true, | ||
"config": { | ||
"publishtest": false | ||
}, | ||
"homepage": "http://npmjs.org/", | ||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/isaacs/npm" | ||
}, | ||
"bugs": { | ||
"email": "npm-@googlegroups.com", | ||
"url": "http://github.com/isaacs/npm/issues" | ||
}, | ||
"directories": { | ||
"doc": "./doc", | ||
"man": "./man", | ||
"lib": "./lib", | ||
"bin": "./bin" | ||
}, | ||
"main": "./lib/npm.js", | ||
"bin": "./bin/npm-cli.js", | ||
"dependencies": { | ||
"semver": "~1.0.14", | ||
"ini": "1", | ||
"slide": "1", | ||
"abbrev": "1", | ||
"graceful-fs": "~1.1.1", | ||
"minimatch": "~0.2", | ||
"nopt": "1", | ||
"node-uuid": "~1.3", | ||
"proto-list": "1", | ||
"rimraf": "2", | ||
"request": "~2.9", | ||
"which": "1", | ||
"tar": "~0.1.12", | ||
"fstream": "~0.1.17", | ||
"block-stream": "*", | ||
"inherits": "1", | ||
"mkdirp": "0.3", | ||
"read": "0", | ||
"lru-cache": "1", | ||
"node-gyp": "~0.4.1", | ||
"fstream-npm": "0 >=0.0.5", | ||
"uid-number": "0", | ||
"archy": "0", | ||
"chownr": "0" | ||
}, | ||
"bundleDependencies": [ | ||
"slide", | ||
"ini", | ||
"semver", | ||
"abbrev", | ||
"graceful-fs", | ||
"minimatch", | ||
"nopt", | ||
"node-uuid", | ||
"rimraf", | ||
"request", | ||
"proto-list", | ||
"which", | ||
"tar", | ||
"fstream", | ||
"block-stream", | ||
"inherits", | ||
"mkdirp", | ||
"read", | ||
"lru-cache", | ||
"node-gyp", | ||
"fstream-npm", | ||
"uid-number", | ||
"archy", | ||
"chownr" | ||
], | ||
"devDependencies": { | ||
"ronn": "https://github.com/isaacs/ronnjs/tarball/master" | ||
}, | ||
"engines": { | ||
"node": "0.6 || 0.7 || 0.8", | ||
"npm": "1" | ||
}, | ||
"scripts": { | ||
"test": "node ./test/run.js", | ||
"prepublish": "npm prune; rm -rf node_modules/*/{test,example,bench}*; make -j4 doc", | ||
"dumpconf": "env | grep npm | sort | uniq" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT +no-false-attribs", | ||
"url": "http://github.com/isaacs/npm/raw/master/LICENSE" | ||
} | ||
] | ||
} |
Oops, something went wrong.