File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 1
- def main [
1
+ #!/usr/bin/env nu
2
+
3
+ export def main [
2
4
-- test-spec-module-name = " test-spec.nu"
3
5
-- as-json
4
6
] {
@@ -33,7 +35,7 @@ def run-test-discoverer [module testImportScript] {
33
35
| from nuon
34
36
}
35
37
36
- def discover-tests [module testImportScript ] {
38
+ export def discover-tests [module testImportScript ] {
37
39
scope modules
38
40
| where name == $module
39
41
| get commands
Original file line number Diff line number Diff line change @@ -73,6 +73,31 @@ export def "test output is tap compliant" [] {
73
73
| verify tap results
74
74
}
75
75
76
+ export def "test can run via nu cli" [] {
77
+ use tests/generic-test-spec .nu "verify json results"
78
+ let specFile = " tests/generic-test-spec.nu"
79
+
80
+ (^$nu.current-exe --no-config-file nuunit.nu -- test-spec-module-name $specFile -- as-json )
81
+ | verify json results
82
+ }
83
+
84
+ export def "test can run via nu script" [] {
85
+ use tests/generic-test-spec .nu "verify json results"
86
+ let specFile = " tests/generic-test-spec.nu"
87
+ let script = $" use nuunit.nu *; nuunit --test-spec-module-name ($specFile ) --as-json"
88
+
89
+ ^$nu.current-exe --no-config-file -c $script
90
+ | verify json results
91
+ }
92
+
93
+ export def "test can run via shebang" [] {
94
+ use tests/generic-test-spec .nu "verify json results"
95
+ let specFile = " tests/generic-test-spec.nu"
96
+
97
+ ^ . /nuunit.nu -- test-spec-module-name ($specFile ) -- as-json
98
+ | verify json results
99
+ }
100
+
76
101
def run-test-spec [specFile ] {
77
102
(^$nu.current-exe --no-config-file nuunit.nu -- test-spec-module-name $specFile -- as-json )
78
103
| from json
Original file line number Diff line number Diff line change
1
+ export def "test 1" [] {}
2
+ export def "test 2" [] {}
3
+ export def "test 3" [] {}
4
+ export def "test 4" [] {}
5
+ export def "test 5" [] {}
6
+
7
+ export def "verify json results" [] {
8
+ let results = $in | from json
9
+ print $results
10
+ use std assert
11
+
12
+ assert equal 5 ($results | length )
13
+ }
You can’t perform that action at this time.
0 commit comments