mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-29 04:12:46 +00:00
Clean up JSON parsing code. Refs #1374.
Fix Engine.ReadJSONFile() which did throw a JS exception that was not caught. Discovered by s0600204. Expose Engine.ReadJSONFile() to the gui scripts. This was SVN commit r15959.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
std::string stringified = script.StringifyJSON(&val);
|
||||
TS_ASSERT_STR_EQUALS(stringified, "{\n \"x\": 1,\n \"z\": [\n 2,\n \"3\xE2\x98\xBA\xEF\xBF\xBD\"\n ],\n \"y\": true\n}");
|
||||
|
||||
script.ParseJSON(stringified, &val);
|
||||
TS_ASSERT(script.ParseJSON(stringified, &val));
|
||||
TS_ASSERT_WSTR_EQUALS(script.ToString(&val), L"({x:1, z:[2, \"3\\u263A\\uFFFD\"], y:true})");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user