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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ The `setup` file is parsed using an Abstract Syntax Tree. This tree contains the
44
44
45
45
**Convert** options are defined **outside** of the `type Copygen Interface` and may apply to multiple functions. As a result, all `ast.Comments` must be parsed before `models.Function` and `models.Field` objects can be created. In order to do this, the `type Copygen Interface` is stored, but **NOT** analyzed until the `setup` file is traversed.
46
46
47
-
There are multiple ways to parse `ast.Comments` into `Options`, but **convert** options require the name of their respective **convert** functions _(which can't be parsed from comments)_. As a result, the most readable, efficient, and least error prone method of parsing `ast.Comments` into `Options`is simply to parse them when discovered; and assign them from a `CommentOptionMap` later. In addition, regex compilation is expensive — [especially in Go](https://github.com/mariomka/regex-benchmark#performance) — and avoided by only compiling unique comments once.
47
+
There are multiple ways to parse `ast.Comments` into `Options`, but **convert** options require the name of their respective **convert** functions _(which can't be parsed from comments)_. As a result, the most readable, efficient, and least error prone method of parsing `ast.Comments` into `Options` is to parse them when discovered; and assign them from a `CommentOptionMap` later. In addition, regex compilation is expensive — [especially in Go](https://github.com/mariomka/regex-benchmark#performance) — and avoided by only compiling unique comments once.
48
48
49
49
#### Copygen Interface
50
50
@@ -130,7 +130,7 @@ If you receive `File is not ... with -...`, use `golangci-lint run --disable-all
130
130
131
131
### Tests
132
132
133
-
For information on testing, read [Integration Tests](examples/_tests/).
133
+
For information on testing, read [Tests](examples/_tests/).
Run unit and integration tests using `go test ./_tests` from `cd examples`.
4
4
5
+
## Integration Tests
6
+
7
+
The command line interface is straightforward. The loader uses a tested library. The matcher matches fields to other fields, which the generator depends on. Field-matching is heavily dependent on the `parser`, which provides the User Interface for end users _(developers)_. As a result, the `parser` contains the majority of edge cases this program encounters. Testing the entire program from end-to-end is more effective than unit tests _(with the exception of option-parsing)_.
@@ -12,9 +15,5 @@ The examples in this folder are used for testing.
12
15
| Duplicate | Defines two structs with duplicate definitions, but not names. |
13
16
| Import | Imports a package in the setup file, that the output file exists in. |
14
17
| Multi | Tests all types using multiple functions. |
18
+
| Option | Tests Generator and Function option-parsing. |
15
19
16
-
## Integration Tests
17
-
18
-
The command line interface is straightforward. The loader uses a tested library. The matcher matches fields to other fields, which the generator depends on. Field-matching is heavily dependent on the `parser`, which provides the User Interface for end users _(developers)_. As a result, the `parser` contains the majority of edge cases this program encounters. Testing the entire program from end-to-end is more effective than unit tests for each package.
19
-
20
-
Run integration tests using `go test ./_tests` from `cd examples`.
0 commit comments