test: add external test

This commit is contained in:
Shunsuke Shibayama 2023-11-12 12:28:57 +09:00
parent cfd24ea6fc
commit 6d12e09b29
3 changed files with 12 additions and 1 deletions

View file

@ -1,5 +1,6 @@
time = pyimport "time"
tqdm = pyimport "tqdm"
j2 = pyimport "jinja2"
for! tqdm.Tqdm!(0..<100), _ =>
time.sleep! 0.01
@ -10,3 +11,6 @@ discard plt.plot! 0..<10, [2, 3, 2, 3, 2, 3, 2, 3, 2, 3]
discard plt.title! "My Plot"
discard plt.xlabel! "X"
plt.show!()
res = j2.Template("Hello {{ name }}!").render(name:="World")
assert res == "Hello World!"

View file

@ -1,5 +1,6 @@
time = pyimport "time"
tqdm = pyimport "tqdm"
j2 = pyimport "jinja2"
for! tqdm.Tqdm!(0..<10), _ =>
time.sleep! 0.00001
@ -10,3 +11,6 @@ discard plt.plot! 0..<10, [2, 3, 2, 3, 2, 3, 2, 3, 2, 3]
discard plt.title! "My Plot"
discard plt.xlabel! "X"
# plt.show!()
res = j2.Template("Hello {{ name }}!").render(name:="World")
assert res == "Hello World!"

View file

@ -124,7 +124,10 @@ fn exec_empty_check() -> Result<(), ()> {
#[test]
fn exec_external() -> Result<(), ()> {
let py_command = opt_which_python().unwrap();
if module_exists(&py_command, "matplotlib") && module_exists(&py_command, "tqdm") {
if module_exists(&py_command, "matplotlib")
&& module_exists(&py_command, "tqdm")
&& module_exists(&py_command, "jinja2")
{
expect_success("tests/should_ok/external.er", 0)
} else {
expect_compile_success("tests/should_ok/external.er", 0)