-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add builtin testing mechanism (#365)
- Loading branch information
1 parent
e5bb859
commit 0055ab4
Showing
48 changed files
with
1,038 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Test subcommand | ||
--- | ||
|
||
The `test` subcommand can be used to run individual tests or the whole test suite. | ||
|
||
## Usage | ||
=== "Long form" | ||
Use the `test` subcommand by executing: | ||
```sh | ||
$ spice test [options] <test-source-file> | ||
``` | ||
=== "Short form" | ||
Use the `test` subcommand by executing: | ||
```sh | ||
$ spice t [options] <test-source-file> | ||
``` | ||
|
||
## Options | ||
You can apply following options to the `test` subcommand: | ||
|
||
| Option | Long | Description | | ||
|--------------|----------------------|---------------------------------------------------------------------------------------------| | ||
| `-a` | `--run-all` | Print compiler output for debugging. | | ||
| `-t` | `--test` | Runs a single test case by its name | | ||
| `-d` | `--debug-output` | Print compiler output for debugging. | | ||
| `-cst` | `--dump-cst` | Dump CST as serialized string and SVG image | | ||
| `-ast` | `--dump-ast` | Dump AST as serialized string and SVG image | | ||
| `-symtab` | `--dump-symtab` | Dump serialized symbol tables | | ||
| `-ir` | `--dump-ir` | Dump LLVM-IR | | ||
| `-s`, `-asm` | `--dump-assembly` | Dump Assembly code | | ||
| `-j <n>` | `--jobs <n>` | Set number of jobs to parallelize compilation (default is auto) | | ||
| `-O<x>` | - | Set optimization level. <br> Valid options: `-O0`, `-O1`, `-O2`, `-O3`, `-Os`, `-Oz` | | ||
| `-g` | `--debug-info` | Generate debug info to debug the executable in GDB, etc. | | ||
| - | `--disable-verifier` | Disable LLVM module and function verification (only recommended for debugging the compiler) | | ||
| - | `--ignore-cache` | Compile always and ignore the compile cache | | ||
| - | `--enable-ast-opt` | Enable AST optimization | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
--- | ||
title: Uninstall command | ||
title: Uninstall subcommand | ||
--- | ||
|
||
The `uninstall` command can be used to delete an installed executable again. | ||
The `uninstall` subcommand can be used to delete an installed executable again. | ||
|
||
## Usage | ||
=== "Long form" | ||
Use the `uninstall` command by executing: | ||
Use the `uninstall` subcommand by executing: | ||
```sh | ||
$ spice uninstall [main-source-file] | ||
$ spice uninstall [options] <main-source-file> | ||
``` | ||
=== "Short form" | ||
Use the `uninstall` command by executing: | ||
Use the `uninstall` subcommand by executing: | ||
```sh | ||
$ spice u [mail-source-file] | ||
$ spice u [options] <mail-source-file> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,31 @@ | ||
type T dyn; | ||
type T int|double; | ||
f<int> add(int a, int b) { | ||
return a + b; | ||
} | ||
|
||
f<int> main() {} | ||
#[test] | ||
f<bool> testAdd() { | ||
assert add(1, 2) == 3; | ||
assert add(2, 2) == 4; | ||
assert add(3, 2) == 5; | ||
return true; | ||
} | ||
|
||
#[test] | ||
f<bool> testAdd1() { | ||
assert add(1, 2) == 3; | ||
assert add(2, 2) == 4; | ||
assert add(3, 2) == 5; | ||
return false; | ||
} | ||
|
||
#[test] | ||
f<bool> testAdd2() { | ||
assert add(1, 2) == 3; | ||
assert add(2, 2) == 4; | ||
assert add(3, 2) == 5; | ||
return false; | ||
} | ||
|
||
f<int> main() { | ||
printf("%d\n", add(1, 2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
public type Driveable interface { | ||
public p drive(int); | ||
public f<bool> isDriving(); | ||
} | ||
|
||
#[test] | ||
f<bool> testDriveable() { | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.