Skip to content

Commit 61bc125

Browse files
committed
Remove the idea of libraries from unit test tasks
1 parent d2bd72b commit 61bc125

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ task build:unit-test-<lib_name>
4444
```
4545

4646
## Testing
47-
To build and run all unit tests:
47+
To build and run unit tests for a specific library:
4848
```shell
49-
task test-all
49+
task test-<lib_name>
5050
```
5151

52-
To build and run unit tests for a single library:
52+
#### Special Targets
53+
To build and run all unit tests:
5354
```shell
54-
task test-<lib_name>
55+
task test-all
5556
```
5657

5758
## Linting

taskfile.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ vars:
1111
G_CPP_SRC_DIR: "{{.ROOT_DIR}}/src"
1212
G_DEPS_DIR: "{{.G_BUILD_DIR}}/deps"
1313
G_TEST_BIN_DIR: "{{.G_BUILD_DIR}}/testbin"
14-
G_YSTDLIBS:
14+
G_TEST_TARGET_SUFFIXES:
15+
- "all"
1516
- "testlib"
1617

1718
tasks:
@@ -27,15 +28,8 @@ tasks:
2728
cmds:
2829
- "mkdir -p '{{.G_BUILD_DIR}}'"
2930

30-
test-all:
31-
desc: "Runs all unit tests."
32-
deps:
33-
- "build:unit-test-all"
34-
cmds:
35-
- "{{.G_TEST_BIN_DIR}}/unit-test-all"
36-
3731
test-*:
38-
desc: "Runs unit tests for the specified library."
32+
desc: "Runs unit tests for the specified library. See ystdlib-cpp README for special targets."
3933
vars:
4034
TEST_TARGET: >-
4135
{{printf "unit-test-%s" (index .MATCH 0)}}

taskfiles/build.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ tasks:
3030
- "{{.TARGET}}"
3131

3232
unit-test-*:
33-
desc: "Builds the unit test target for the specified library."
33+
desc: "Builds the specified unit test target."
3434
vars:
35-
LIBRARY: >-
35+
TARGET_SUFFIX: >-
3636
{{index .MATCH 0}}
37-
TEST_TARGET: >-
38-
{{printf "unit-test-%s" .LIBRARY}}
37+
TARGET_NAME: >-
38+
{{printf "unit-test-%s" .TARGET_SUFFIX}}
3939
preconditions:
4040
- sh: >-
41-
{{or (eq .LIBRARY `all`) (has .LIBRARY .G_YSTDLIBS)}}
41+
{{(has .TARGET_SUFFIX .G_TEST_TARGET_SUFFIXES)}}
4242
msg: |-
43-
{{.LIBRARY}} is not a valid ystdlib-cpp library!
44-
List of libraries:
45-
{{- range .G_YSTDLIBS }}
46-
{{.}}
43+
{{.TARGET_NAME}} is not a valid unit test target!
44+
List of unit test targets:
45+
{{- range .G_TEST_TARGET_SUFFIXES }}
46+
unit-test-{{.}}
4747
{{- end}}
4848
cmds:
49-
- task: "target-{{.TEST_TARGET}}"
49+
- task: "target-{{.TARGET_NAME}}"
5050

5151
clean:
5252
desc: "Removes all built artifacts."

0 commit comments

Comments
 (0)