BLUELOVETH há 2 anos atrás
pai
commit
c1abf1b492
5 ficheiros alterados com 9 adições e 3 exclusões
  1. 1 1
      src/main.cpp
  2. 2 2
      tests/30_import.py
  3. 1 0
      tests/test1/__init__.py
  4. 4 0
      tests/test1/_a.py
  5. 1 0
      tests/test1/_b.py

+ 1 - 1
src/main.cpp

@@ -46,7 +46,7 @@ int main(int argc, char** argv){
         std::filesystem::current_path(filepath.parent_path());
 
         pkpy::PyObject* ret = nullptr;
-        ret = vm->exec(src.c_str(), argv_1, pkpy::EXEC_MODE);
+        ret = vm->exec(src.c_str(), filepath.filename().string(), pkpy::EXEC_MODE);
         pkpy_delete(vm);
         return ret != nullptr ? 0 : 1;
     }

+ 2 - 2
tests/30_import.py

@@ -1,3 +1,3 @@
-import test
+import test1
 
-assert test.add(1, 2) == 13
+assert test1.add(1, 2) == 13

+ 1 - 0
tests/test1/__init__.py

@@ -0,0 +1 @@
+from ._a import add

+ 4 - 0
tests/test1/_a.py

@@ -0,0 +1,4 @@
+from ._b import C
+
+def add(a, b):
+    return a + b + C

+ 1 - 0
tests/test1/_b.py

@@ -0,0 +1 @@
+from test2 import D as C