You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `version` package is tested both via unit and e2e tests.
4
+
5
+
## Unit tests
6
+
7
+
Unit tests focus more on the corner cases that are hard to reproduce using e2e testing. Unit tests are executed on CI via [**Testing**](https://github.com/mszostok/version/actions/workflows/testing.yml) workflow.
8
+
9
+
- All tests are executed with the latest Go version on all platforms, using GitHub Action job strategy:
10
+
```yaml
11
+
strategy:
12
+
matrix:
13
+
os: [ubuntu-latest, macos-latest, windows-latest]
14
+
```
15
+
- All tests are run both on pull-requests and the `main` branch
16
+
- The tests' coverage is uploaded to [coveralls.io/github/mszostok/version](https://coveralls.io/github/mszostok/version)
17
+
18
+
## E2E tests
19
+
20
+
The e2e tests build a Go binary, run it, and compare with [golden files](https://github.com/mszostok/version/tree/main/tests/e2e/testdata). E2E tests are executed on CI via [**Testing**](https://github.com/mszostok/version/actions/workflows/testing.yml) workflow.
21
+
22
+
As a result, e2e test focus on:
23
+
24
+
- Building Go binaries
25
+
- Overriding version information via `ldflags`
26
+
- Running binary on operating system
27
+
- Testing if color output for non-tty output streams is disabled automatically
28
+
- Ensuring that all [examples](https://github.com/mszostok/version/tree/main/examples) are runnable
29
+
- Executing a real call against GitHub API
30
+
- Executing binaries on all platforms, using GitHub Action job strategy:
31
+
```yaml
32
+
strategy:
33
+
matrix:
34
+
os: [ubuntu-latest, macos-latest, windows-latest]
35
+
```
36
+
37
+
Each time a new functionality is implemented, a dedicated [test case](https://github.com/mszostok/version/blob/main/tests/e2e/e2e_test.go#L31) is added.
38
+
39
+
!!! note
40
+
41
+
Currently, there is no easy way to calculate the coverage based on the e2e tests (built and executed binaries). However, this will be enabled once the [golang#51430](https://github.com/golang/go/issues/51430) issue will be implemented.
Copy file name to clipboardExpand all lines: docs/customization/pretty/format.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# Format
2
2
3
3
!!! note ""
4
+
4
5
Formatting focuses on the style of your displayed pretty version data.
5
6
6
7
Format lets you define your own theme and adjust the output to your branding colors. In general, you can add underscores, bold and italic formatting, text, and background colors.
Copy file name to clipboardExpand all lines: docs/customization/pretty/layout.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,15 @@
1
1
# Layout
2
2
3
3
!!! note ""
4
+
4
5
Layout focuses on structured arrangement of pretty version data.
5
6
6
7
To define the layout, use [Go templating](https://pkg.go.dev/html/template). You can also use the [`version` package's built-in functions](https://github.com/mszostok/version/blob/main/style/go-tpl-funcs.go) that respect the [formatting settings](./format.md). All helper functions defined by the [Sprig template library](https://masterminds.github.io/sprig/) are also available.
7
8
8
9
These are the fields that you can access in your Go template definition:
0 commit comments