mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 20:16:03 +01:00
Add test case for json with comments
This commit is contained in:
parent
d4c562c6ff
commit
d95ff93e70
2 changed files with 62 additions and 0 deletions
1
tests/functional/lang/eval-okay-fromjson-comments.exp
Normal file
1
tests/functional/lang/eval-okay-fromjson-comments.exp
Normal file
|
|
@ -0,0 +1 @@
|
|||
true
|
||||
61
tests/functional/lang/eval-okay-fromjson-comments.nix
Normal file
61
tests/functional/lang/eval-okay-fromjson-comments.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
builtins.fromJSON ''
|
||||
{
|
||||
// This is a comment
|
||||
"Video": {
|
||||
/* Multi line comment single line */
|
||||
"Title": "The Penguin Chronicles",
|
||||
"Width": 1920,
|
||||
"Height": 1080,
|
||||
/**
|
||||
* Multi line comment
|
||||
* with multiple lines
|
||||
*/
|
||||
"EmbeddedData": [3.14159, 23493,null, true ,false, -10],
|
||||
"Thumb": {
|
||||
"Url": "http://www.example.com/video/5678931",
|
||||
"Width": 200,
|
||||
"Height": 250
|
||||
},
|
||||
"Animated" : false,
|
||||
"IDs": [116, 943, 234, 38793, true ,false,null, -100],
|
||||
"Escapes": "\"\\\/\t\n\r\t",
|
||||
"Subtitle" : false,
|
||||
"Latitude": 37.7668,
|
||||
"Longitude": -122.3959
|
||||
}
|
||||
}
|
||||
'' == {
|
||||
Video = {
|
||||
Title = "The Penguin Chronicles";
|
||||
Width = 1920;
|
||||
Height = 1080;
|
||||
EmbeddedData = [
|
||||
3.14159
|
||||
23493
|
||||
null
|
||||
true
|
||||
false
|
||||
(0 - 10)
|
||||
];
|
||||
Thumb = {
|
||||
Url = "http://www.example.com/video/5678931";
|
||||
Width = 200;
|
||||
Height = 250;
|
||||
};
|
||||
Animated = false;
|
||||
IDs = [
|
||||
116
|
||||
943
|
||||
234
|
||||
38793
|
||||
true
|
||||
false
|
||||
null
|
||||
(0 - 100)
|
||||
];
|
||||
Escapes = "\"\\\/\t\n\r\t"; # supported in JSON but not Nix: \b\f
|
||||
Subtitle = false;
|
||||
Latitude = 37.7668;
|
||||
Longitude = -122.3959;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue