Skip to content

Commit 7f3f2b9

Browse files
committedApr 27, 2023
Test case for generateOutput
This patch updates the generateOutput function to use an external C parser for dot parsing. It includes the addition of CGO and a dedicated test case for the parser itself, which runs generateOutput and parses the resulting dot file. Signed-off-by: Alessandro Carminati <alessandro.carminati@gmail.com>
1 parent fc937b5 commit 7f3f2b9

16 files changed

+902
-472
lines changed
 

‎Makefile

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
all: nav.go
2-
go build
3-
4-
aarch64: nav.go
5-
GOARCH="arm64" GOOS="linux" go build
6-
7-
amd64: nav.go
8-
GOARCH="amd64" GOOS="linux" go build
2+
go build -ldflags="-r ."
93

104
upx: nav
115
upx nav
126

137
test:
14-
go test -cover
8+
go test -cover -v
159
go test ./config -v -cover
1610

1711
code/check:

‎config/config.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ type Config struct {
1717
}
1818

1919
type ConfValues struct {
20-
Symbol string `json:"symbol"`
21-
Type string `json:"output_type"`
22-
DBDriver string `json:"db_driver"`
23-
DBDSN string `json:"DBDSN"`
24-
ExcludedBefore []string `json:"excluded_before"`
25-
ExcludedAfter []string `json:"excluded_after"`
26-
TargetSubsys []string `json:"target_subsys"`
27-
MaxDepth int `json:"max_depth"`
28-
Mode c.OutMode `json:"mode"`
29-
DBInstance int `json:"db_instance"`
20+
Symbol string `json:"symbol"`
21+
Type string `json:"output_type"`
22+
DBDriver string `json:"db_driver"`
23+
DBDSN string `json:"DBDSN"`
24+
ExcludedBefore []string `json:"excluded_before"`
25+
ExcludedAfter []string `json:"excluded_after"`
26+
TargetSubsys []string `json:"target_subsys"`
27+
MaxDepth int `json:"max_depth"`
28+
Mode c.OutMode `json:"mode"`
29+
Graphviz c.OutIMode `json:"out_type"`
30+
DBInstance int `json:"db_instance"`
3031
}
3132

3233
// New creates a new Config instance and returns a pointer to it.

‎constants/const.go

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ const (
66
)
77

88
type OutMode int64
9+
type OutIMode int64
10+
11+
const (
12+
_ OutIMode = iota
13+
OText
14+
OPNG
15+
OJPG
16+
OSVG
17+
OutIModeLast
18+
)
919

1020
// Const values for configuration mode field.
1121
const (

0 commit comments

Comments
 (0)