Skip to content

Commit 09f3a4b

Browse files
committed
Add more tests cases for metacallcli.
1 parent df8b98f commit 09f3a4b

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

source/examples/metacallcli/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ if(OPTION_BUILD_LOADERS AND OPTION_BUILD_LOADERS_NODE AND OPTION_BUILD_SCRIPTS A
148148
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
149149
)
150150
endif()
151+
152+
if(OPTION_BUILD_PORTS AND OPTION_BUILD_PORTS_PY)
153+
add_test(NAME ${target}-py-port
154+
COMMAND ${TEST_COMMAND} "echo 'load py test.py\ninspect\ncall test()\nexit' | $<TARGET_FILE:${target}>"
155+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
156+
)
157+
endif()
151158
endif()
152159

153160
#
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
# Target function
24
def a():
35
return 'a'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import sys
5+
6+
abspath = os.path.dirname(os.path.abspath(__file__));
7+
relpath = '../../../ports/py_port/package';
8+
9+
sys.path.append(os.path.normpath(os.path.join(abspath, relpath)));
10+
11+
from metacall import metacall, metacall_load_from_file
12+
13+
metacall_load_from_file('mock', ['test.mock']);
14+
15+
def test():
16+
return metacall('three_str', 'a', 'b', 'c');

0 commit comments

Comments
 (0)