• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/99_bugs/09_reject_invalid_array_indexes

  1 Since libjson-c's json_object_get_int64() returns 0 for any input value
  2 that has no integer representation, any kind of invalid array index
  3 incorrectly yielded the first array element.
  4 
  5 -- Testcase --
  6 {%
  7         x = [1, 2, 3];
  8 
  9         print([
 10                 x[1],
 11                 x["1"],
 12                 x[1.0],
 13                 x[1.1],
 14                 x.foo,
 15                 x["foo"],
 16                 x["0abc"],
 17                 x[x],
 18                 x[{ foo: true }]
 19         ], "\n");
 20 %}
 21 -- End --
 22 
 23 -- Expect stdout --
 24 [ 2, 2, 2, null, null, null, null, null, null ]
 25 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt