Skip to content

Commit

Permalink
Wow, I'm good, this is clever and fully functionalgit add .!
Browse files Browse the repository at this point in the history
  • Loading branch information
marsninja committed Sep 16, 2023
1 parent 6a0f043 commit 5557ea6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jaclang/cli/cmds.jac
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ can run(filename: str);
@cmd_reg.register
can enter(filename: str, entrypoint: str, args: list);

@cmd_reg.register
can <>test(filename: str);

@cmd_reg.register
can ast_tool(tool: str);

Expand Down
15 changes: 15 additions & 0 deletions jaclang/cli/impl/cmds_impl.jac
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Implementations for the jac command line interface."""
import:py os;
import:py shutil;
import:py unittest;

"""Load a .jac file and return the entrypoint function."""
:a:run
Expand Down Expand Up @@ -29,6 +30,20 @@ import:py shutil;
}
}

"""Load a .jac file and return the entrypoint function."""
:a:<>test
(filename: str) {
if filename.endswith(".jac"){
[base, mod] = os.path.split(filename);
base = './' if not base else base;
mod=mod[:-4];
mod = __jac_import__(target=mod, base_path=base);
unittest.TextTestRunner().run(mod.__jac_suite__);
} else {
"Not a .jac file." :> print;
}
}

:a:ast_tool
(tool: str) {
import:py from jaclang.utils.lang_tools, AstTool;
Expand Down

0 comments on commit 5557ea6

Please sign in to comment.