Skip to content

Commit 813deb8

Browse files
committed
Update tests for callbacks (python/node).
1 parent b61efd2 commit 813deb8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

source/ports/node_port/test/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ describe('metacall', () => {
142142

143143
// Factorial composition (@trgwii)
144144
/*
145-
const fact = f.function_factorial(c => v => v);
146-
assert.strictEqual(fact(0), 0);
145+
const fact = f.function_factorial(c => v => v <= 0 ? 1 : v);
146+
assert.strictEqual(fact(0), 1);
147147
assert.strictEqual(fact(1), 1);
148148
assert.strictEqual(fact(2), 2);
149149
assert.strictEqual(fact(3), 6);

source/scripts/python/function/source/function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def function_chain(x):
3535
return lambda n: x(x)(n);
3636

3737
def function_factorial(x):
38-
return lambda n: 1 if n == 0 else n * x(x)(n - 1);
38+
return lambda n: 1 if n <= 0 else n * x(x)(n - 1);
3939

4040
class MyClass:
4141
def f(self):

0 commit comments

Comments
 (0)