add code coverage action

This commit is contained in:
Arpad Ryszka 2020-11-26 17:14:45 +01:00
parent 7d211be2dc
commit 71522343d7
2 changed files with 11 additions and 2 deletions

View File

@ -42,6 +42,7 @@ to 112 columns, when the output is considered to be more readable that way. This
are not wrapped even with the **`w`** variant of the functions. are not wrapped even with the **`w`** variant of the functions.
For the available functions, see also the [godoc](https://godoc.org/github.com/aryszka/notation). For the available functions, see also the [godoc](https://godoc.org/github.com/aryszka/notation).
(Alternatively: [pkg.go.dev](https://pkg.go.dev/github.com/aryszka/notation).)
### Example ### Example

View File

@ -123,10 +123,12 @@ func nodeLen(t int, n node) node {
n.wrapLen.first = ifZero(n.wrapLen.first, w) n.wrapLen.first = ifZero(n.wrapLen.first, w)
n.wrapLen.max = max(n.wrapLen.max, w) n.wrapLen.max = max(n.wrapLen.max, w)
w = 0
n.fullWrap.first = ifZero(n.fullWrap.first, f) n.fullWrap.first = ifZero(n.fullWrap.first, f)
n.fullWrap.max = max(n.fullWrap.max, f) n.fullWrap.max = max(n.fullWrap.max, f)
w = 0
f = 0 f = 0
switch pt.mode { switch pt.mode {
case line: case line:
// line wrapping is flexible, here // line wrapping is flexible, here
@ -161,8 +163,9 @@ func nodeLen(t int, n node) node {
} }
n.wrapLen.max = max(n.wrapLen.max, w) n.wrapLen.max = max(n.wrapLen.max, w)
n.fullWrap.max = max(n.fullWrap.max, f)
w = 0 w = 0
n.fullWrap.max = max(n.fullWrap.max, f)
f = 0 f = 0
default: default:
w += len(fmt.Sprint(p)) w += len(fmt.Sprint(p))
@ -170,12 +173,16 @@ func nodeLen(t int, n node) node {
} }
} }
// commit the remaining wrap length
n.wrapLen.first = ifZero(n.wrapLen.first, w) n.wrapLen.first = ifZero(n.wrapLen.first, w)
n.wrapLen.max = max(n.wrapLen.max, w) n.wrapLen.max = max(n.wrapLen.max, w)
n.wrapLen.last = w n.wrapLen.last = w
// commit the remaining full wrap length
n.fullWrap.first = ifZero(n.fullWrap.first, f) n.fullWrap.first = ifZero(n.fullWrap.first, f)
n.fullWrap.max = max(n.fullWrap.max, f) n.fullWrap.max = max(n.fullWrap.max, f)
n.fullWrap.last = f n.fullWrap.last = f
return n return n
} }
@ -313,6 +320,7 @@ func wrapNode(t, cf0, c0, c1 int, n node) node {
} }
func fprint(w *writer, t int, n node) { func fprint(w *writer, t int, n node) {
// handle write errors at a single place:
if w.err != nil { if w.err != nil {
return return
} }