FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
dingo/scripts/diff-visualizer.go at main · MadAppGang/dingo · GitHub
MadAppGang
/
dingo
Public
Notifications
You must be signed in to change notification settings
Fork
40
Star
1.9k
Code
Issues
33
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
dingo
/
scripts
/
diff-visualizer.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
70 lines (60 loc) · 1.52 KB
Breadcrumbs
dingo
/
scripts
/
diff-visualizer.go
Copy path
File metadata and controls
70 lines (60 loc) · 1.52 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//go:build ignore
// diff-visualizer generates markdown visualization of golden test failures
package
main
import
(
"bufio"
"fmt"
"os"
"strings"
)
func
main
() {
if
len
(
os
.
Args
)
<
2
{
fmt
.
Println
(
"# Golden Test Diff Report"
)
fmt
.
Println
(
"
\n
No test output file provided."
)
return
}
file
,
err
:=
os
.
Open
(
os
.
Args
[
1
])
if
err
!=
nil
{
fmt
.
Printf
(
"# Golden Test Diff Report
\n
\n
Error: %v
\n
"
,
err
)
return
}
defer
file
.
Close
()
fmt
.
Println
(
"# Golden Test Diff Report"
)
fmt
.
Println
()
scanner
:=
bufio
.
NewScanner
(
file
)
var
failures
[]
string
var
currentFailure
strings.
Builder
inFailure
:=
false
for
scanner
.
Scan
() {
line
:=
scanner
.
Text
()
if
strings
.
Contains
(
line
,
"--- FAIL:"
) {
if
inFailure
&&
currentFailure
.
Len
()
>
0
{
failures
=
append
(
failures
,
currentFailure
.
String
())
currentFailure
.
Reset
()
}
inFailure
=
true
currentFailure
.
WriteString
(
"## "
+
line
+
"
\n
\n
```
\n
"
)
}
else
if
inFailure
{
if
strings
.
HasPrefix
(
line
,
"FAIL"
)
||
strings
.
HasPrefix
(
line
,
"ok "
) {
currentFailure
.
WriteString
(
"```
\n
"
)
failures
=
append
(
failures
,
currentFailure
.
String
())
currentFailure
.
Reset
()
inFailure
=
false
}
else
{
currentFailure
.
WriteString
(
line
+
"
\n
"
)
}
}
}
if
currentFailure
.
Len
()
>
0
{
currentFailure
.
WriteString
(
"```
\n
"
)
failures
=
append
(
failures
,
currentFailure
.
String
())
}
if
len
(
failures
)
==
0
{
fmt
.
Println
(
"No test failures found in output."
)
return
}
fmt
.
Printf
(
"Found %d test failure(s):
\n
\n
"
,
len
(
failures
))
for
_
,
f
:=
range
failures
{
fmt
.
Println
(
f
)
}
}
Back
|
FazBrowse Home
|
New Git URL