Skip to content

Commit 29c0d89

Browse files
committed
test_run_script for filr/dir
1 parent 2eb97aa commit 29c0d89

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ fn run_script(vm: &VirtualMachine, script_file: &str) -> PyResult {
131131
}
132132
}
133133

134+
#[test]
135+
fn test_run_script() {
136+
let vm = VirtualMachine::new();
137+
138+
// test file run
139+
let r = run_script(&vm, "tests/snippets/dir_main/__main__.py");
140+
assert!(r.is_ok());
141+
142+
// test module run
143+
let r = run_script(&vm, "tests/snippets/dir_main");
144+
assert!(r.is_ok());
145+
}
146+
134147
fn shell_exec(vm: &VirtualMachine, source: &str, scope: Scope) -> Result<(), CompileError> {
135148
match compile::compile(vm, source, &compile::Mode::Single, "<stdin>".to_string()) {
136149
Ok(code) => {

0 commit comments

Comments
 (0)