globals: Fix math operations returning argument list on single arg
This commit is contained in:
parent
39578c9478
commit
154cc42740
3 changed files with 19 additions and 1 deletions
|
|
@ -59,6 +59,7 @@ functionaltest("function-mutable-capture")
|
|||
functionaltest("map")
|
||||
functionaltest("deconstruct")
|
||||
functionaltest("shadowing")
|
||||
functionaltest("mathops")
|
||||
|
||||
install(TARGETS apfl DESTINATION lib)
|
||||
install(TARGETS apfl-bin DESTINATION bin)
|
||||
|
|
|
|||
17
src/functional-tests/mathops.at
Normal file
17
src/functional-tests/mathops.at
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
===== script =====
|
||||
print (+ 1 2)
|
||||
print (+ 1 2 3 4)
|
||||
print (- 1)
|
||||
print (- 1 2)
|
||||
print (- 1 2 3)
|
||||
print (* 1 2 3)
|
||||
print (/ 1 2 4)
|
||||
|
||||
===== output =====
|
||||
3
|
||||
10
|
||||
-1
|
||||
-1
|
||||
-4
|
||||
6
|
||||
0.125
|
||||
|
|
@ -101,7 +101,7 @@ impl_eq(apfl_ctx ctx)
|
|||
apfl_get_list_member_by_index(ctx, 0, 0); \
|
||||
apfl_number num = apfl_get_number(ctx, -1); \
|
||||
if (len == 1) { \
|
||||
single(num); \
|
||||
apfl_push_number(ctx, single(num)); \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
|
|
|
|||
Loading…
Reference in a new issue