inja
inja copied to clipboard
`function(num1 + num2, num3)` seems to run as if it is `function(num1, num2 + num3)`
I inserted the following three lines here and ran tests.
CHECK(env.render("{{ multiply(3, 3) }}", data) == "9.0");
CHECK(env.render("{{ multiply(3, 1 + 2) }}", data) == "9.0");
CHECK(env.render("{{ multiply(1 + 2, 3) }}", data) == "9.0");
The first two lines passed tests as expected. However, the last one failed as follows.
$ make test
Running tests...
Test project /home/kubo/inja/build
Start 1: inja_test
1/2 Test #1: inja_test ........................***Failed 0.02 sec
Start 2: single_inja_test
2/2 Test #2: single_inja_test .................***Failed 0.02 sec
0% tests passed, 2 tests failed out of 2
Total Test time (real) = 0.04 sec
The following tests FAILED:
1 - inja_test (Failed)
2 - single_inja_test (Failed)
Errors while running CTest
make: *** [Makefile:85: test] Error 8
$ ./inja_test
[doctest] doctest version is "2.4.6"
[doctest] run with "--help" for options
===============================================================================
/home/kubo/inja/test/test-functions.cpp:218:
TEST CASE: callbacks
/home/kubo/inja/test/test-functions.cpp:273: ERROR: CHECK( env.render("{{ multiply(1 + 2, 3) }}", data) == "9.0" ) is NOT correct!
values: CHECK( 5.0 == 9.0 )
===============================================================================
[doctest] test cases: 15 | 14 passed | 1 failed | 0 skipped
[doctest] assertions: 246 | 245 passed | 1 failed |
[doctest] Status: FAILURE!
The result of multiply(1 + 2, 3)
is 5.0
. It seems the result of multiply(1, 2 + 3)
.
@pantor Are you going to fix this issue? If no, may I do it?
Please go ahead!
Thanks @kubo for the patch! Can this please be merged into the main repository @pantor ?