-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwrapLine_test.go
35 lines (31 loc) · 1.13 KB
/
wrapLine_test.go
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
package main
import (
"go/format"
"io/ioutil"
"log"
"testing"
)
func Test_wrapLine(t *testing.T) {
text := `
package main
const HandleFullErr = QueueErrType("handleFullError","handleFullError","handleFullError","handleFullError","handleFullError","handleFullError")
/*const HandleFullErr = QueueErrType("handleFullError","handleFullError","handleFullError","handleFullError","handleFullError","handleFullError")*/
// const HandleFullErr = QueueErrType("handleFullError","handleFullError","handleFullError","handleFullError","handleFullError","handleFullError")
const HandleFullErr1 = QueueErrType("handleFullError, handleFullError, handleFullError, handleFullError, handleFullError,handleFullError,handleFullError,handleFullError,handleFullError,handleFullError,handleFullError")`
ret := wrapLine(text)
fmtRet, err := format.Source([]byte(ret))
if err != nil {
t.Error(err)
return
}
log.Printf("ret:%s", fmtRet)
}
func Test_wrapLine2(t *testing.T) {
bts, err := ioutil.ReadFile("./wrapLineExample.txt")
if err != nil {
t.Fatal(err)
}
ret := wrapLine(string(bts))
fmtRet, err := format.Source([]byte(ret))
log.Printf("ret:%s", fmtRet)
}