expressions_test: add test for unicode attribute name
Refs #1153 That issue doesn't affect current master, maybe it was valid at the time of posting. I just couldn't find a test that'd confirm unicode in attribute names actually works, so here it is.
This commit is contained in:
parent
6befc23101
commit
5544c4c74f
1 changed files with 12 additions and 2 deletions
|
@ -65,6 +65,7 @@ TEST_CASE("expressions")
|
|||
{ "grass" , tr.transcode("grow")},
|
||||
{ "wind" , tr.transcode("blow")},
|
||||
{ "sky" , tr.transcode("is blue")},
|
||||
{ "τ" , mapnik::value_double(6.2831853)},
|
||||
{ "double", mapnik::value_double(1.23456)},
|
||||
{ "int" , mapnik::value_integer(123)},
|
||||
{ "bool" , mapnik::value_bool(true)},
|
||||
|
@ -74,8 +75,6 @@ TEST_CASE("expressions")
|
|||
auto eval = std::bind(evaluate_string, feature, _1);
|
||||
auto approx = Approx::custom().epsilon(1e-6);
|
||||
|
||||
TRY_CHECK(eval(" [foo]='bar' ") == true);
|
||||
|
||||
// primary expressions
|
||||
// null
|
||||
TRY_CHECK(parse_and_dump("null") == "null");
|
||||
|
@ -98,6 +97,17 @@ TEST_CASE("expressions")
|
|||
TRY_CHECK(parse_and_dump("deg_to_rad") == "0.0174533");
|
||||
TRY_CHECK(parse_and_dump("rad_to_deg") == "57.2958");
|
||||
|
||||
// ascii attribute name
|
||||
TRY_CHECK(eval(" [foo]='bar' ") == true);
|
||||
|
||||
// unicode attribute name
|
||||
TRY_CHECK(eval("[τ]") == prop.at("τ"));
|
||||
TRY_CHECK(eval("[τ]") == eval(u8"[\u03C4]"));
|
||||
|
||||
// change to TRY_CHECK once \u1234 escape sequence in attribute name
|
||||
// is implemented in expression grammar
|
||||
CHECK_NOFAIL(eval("[τ]") == eval("[\\u03C3]"));
|
||||
|
||||
// unary functions
|
||||
// sin / cos
|
||||
TRY_CHECK(eval(" sin(0.25 * pi) / cos(0.25 * pi) ").to_double() == approx(1.0));
|
||||
|
|
Loading…
Reference in a new issue