forked from google/jsonnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for locale affecting output
See google#722
- Loading branch information
1 parent
1ccc8bc
commit 12d9bb7
Showing
4 changed files
with
38 additions
and
2 deletions.
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
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 @@ | ||
#include <iostream> | ||
#include <locale> | ||
#include <cassert> | ||
#include <libjsonnet++.h> | ||
|
||
// Regression test for the follwing issue: https://github.com/google/jsonnet/issues/722 | ||
|
||
int main() { | ||
std::string templatedJSONString { "2000" }; | ||
std::locale glocale("en_US.UTF-8"); | ||
std::locale::global(glocale); | ||
|
||
jsonnet::Jsonnet jsonnet {}; | ||
jsonnet.init(); | ||
|
||
std::string expanded; | ||
if (!jsonnet.evaluateSnippet("", templatedJSONString, &expanded)) { | ||
std::cerr << "Error parsing Jsonnet: "+jsonnet.lastError(); | ||
exit(1); | ||
} | ||
std::string expected = "2000\n"; | ||
assert(expected == expanded); | ||
return 0; | ||
} |
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