Skip to content

Commit 6c786a0

Browse files
authored
Merge pull request #1 from LandonTClipp/testing
Modify tests & CI/CD for chigopher fork
2 parents 5dd12d0 + d834397 commit 6c786a0

File tree

12 files changed

+143
-154
lines changed

12 files changed

+143
-154
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Go Test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ macos-latest, ubuntu-latest]
15+
go_vers: ['1.20']
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go_vers }}
25+
26+
- name: Download dependencies
27+
run: go mod download -x
28+
29+
- name: Test
30+
run: make test

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PKGS := github.com/pkg/errors
1+
PKGS := github.com/chigopher/errors
22
SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS))
33
GO := go
44

appveyor.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

bench_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build go1.7
12
// +build go1.7
23

34
package errors
@@ -41,7 +42,7 @@ func BenchmarkErrors(b *testing.B) {
4142
{1000, true},
4243
}
4344
for _, r := range runs {
44-
part := "pkg/errors"
45+
part := "chigopher/errors"
4546
if r.std {
4647
part = "errors"
4748
}

example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package errors_test
33
import (
44
"fmt"
55

6-
"github.com/pkg/errors"
6+
"github.com/chigopher/errors"
77
)
88

99
func ExampleNew() {

format_test.go

Lines changed: 69 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ func TestFormatNew(t *testing.T) {
2626
New("error"),
2727
"%+v",
2828
"error\n" +
29-
"github.com/pkg/errors.TestFormatNew\n" +
30-
"\t.+/github.com/pkg/errors/format_test.go:26",
29+
"github.com/chigopher/errors.TestFormatNew\n" +
30+
"\t.+/format_test.go:26",
3131
}, {
3232
New("error"),
3333
"%q",
@@ -56,8 +56,8 @@ func TestFormatErrorf(t *testing.T) {
5656
Errorf("%s", "error"),
5757
"%+v",
5858
"error\n" +
59-
"github.com/pkg/errors.TestFormatErrorf\n" +
60-
"\t.+/github.com/pkg/errors/format_test.go:56",
59+
"github.com/chigopher/errors.TestFormatErrorf\n" +
60+
"\t.+/format_test.go:56",
6161
}}
6262

6363
for i, tt := range tests {
@@ -82,8 +82,8 @@ func TestFormatWrap(t *testing.T) {
8282
Wrap(New("error"), "error2"),
8383
"%+v",
8484
"error\n" +
85-
"github.com/pkg/errors.TestFormatWrap\n" +
86-
"\t.+/github.com/pkg/errors/format_test.go:82",
85+
"github.com/chigopher/errors.TestFormatWrap\n" +
86+
"\t.+/format_test.go:82",
8787
}, {
8888
Wrap(io.EOF, "error"),
8989
"%s",
@@ -97,15 +97,15 @@ func TestFormatWrap(t *testing.T) {
9797
"%+v",
9898
"EOF\n" +
9999
"error\n" +
100-
"github.com/pkg/errors.TestFormatWrap\n" +
101-
"\t.+/github.com/pkg/errors/format_test.go:96",
100+
"github.com/chigopher/errors.TestFormatWrap\n" +
101+
"\t.+/format_test.go:96",
102102
}, {
103103
Wrap(Wrap(io.EOF, "error1"), "error2"),
104104
"%+v",
105105
"EOF\n" +
106106
"error1\n" +
107-
"github.com/pkg/errors.TestFormatWrap\n" +
108-
"\t.+/github.com/pkg/errors/format_test.go:103\n",
107+
"github.com/chigopher/errors.TestFormatWrap\n" +
108+
"\t.+/format_test.go:103\n",
109109
}, {
110110
Wrap(New("error with space"), "context"),
111111
"%q",
@@ -135,8 +135,8 @@ func TestFormatWrapf(t *testing.T) {
135135
"%+v",
136136
"EOF\n" +
137137
"error2\n" +
138-
"github.com/pkg/errors.TestFormatWrapf\n" +
139-
"\t.+/github.com/pkg/errors/format_test.go:134",
138+
"github.com/chigopher/errors.TestFormatWrapf\n" +
139+
"\t.+/format_test.go:134",
140140
}, {
141141
Wrapf(New("error"), "error%d", 2),
142142
"%s",
@@ -149,8 +149,8 @@ func TestFormatWrapf(t *testing.T) {
149149
Wrapf(New("error"), "error%d", 2),
150150
"%+v",
151151
"error\n" +
152-
"github.com/pkg/errors.TestFormatWrapf\n" +
153-
"\t.+/github.com/pkg/errors/format_test.go:149",
152+
"github.com/chigopher/errors.TestFormatWrapf\n" +
153+
"\t.+/format_test.go:149",
154154
}}
155155

156156
for i, tt := range tests {
@@ -175,8 +175,8 @@ func TestFormatWithStack(t *testing.T) {
175175
WithStack(io.EOF),
176176
"%+v",
177177
[]string{"EOF",
178-
"github.com/pkg/errors.TestFormatWithStack\n" +
179-
"\t.+/github.com/pkg/errors/format_test.go:175"},
178+
"github.com/chigopher/errors.TestFormatWithStack\n" +
179+
"\t.+/format_test.go:175"},
180180
}, {
181181
WithStack(New("error")),
182182
"%s",
@@ -189,37 +189,37 @@ func TestFormatWithStack(t *testing.T) {
189189
WithStack(New("error")),
190190
"%+v",
191191
[]string{"error",
192-
"github.com/pkg/errors.TestFormatWithStack\n" +
193-
"\t.+/github.com/pkg/errors/format_test.go:189",
194-
"github.com/pkg/errors.TestFormatWithStack\n" +
195-
"\t.+/github.com/pkg/errors/format_test.go:189"},
192+
"github.com/chigopher/errors.TestFormatWithStack\n" +
193+
"\t.+/format_test.go:189",
194+
"github.com/chigopher/errors.TestFormatWithStack\n" +
195+
"\t.+/format_test.go:189"},
196196
}, {
197197
WithStack(WithStack(io.EOF)),
198198
"%+v",
199199
[]string{"EOF",
200-
"github.com/pkg/errors.TestFormatWithStack\n" +
201-
"\t.+/github.com/pkg/errors/format_test.go:197",
202-
"github.com/pkg/errors.TestFormatWithStack\n" +
203-
"\t.+/github.com/pkg/errors/format_test.go:197"},
200+
"github.com/chigopher/errors.TestFormatWithStack\n" +
201+
"\t.+/format_test.go:197",
202+
"github.com/chigopher/errors.TestFormatWithStack\n" +
203+
"\t.+/format_test.go:197"},
204204
}, {
205205
WithStack(WithStack(Wrapf(io.EOF, "message"))),
206206
"%+v",
207207
[]string{"EOF",
208208
"message",
209-
"github.com/pkg/errors.TestFormatWithStack\n" +
210-
"\t.+/github.com/pkg/errors/format_test.go:205",
211-
"github.com/pkg/errors.TestFormatWithStack\n" +
212-
"\t.+/github.com/pkg/errors/format_test.go:205",
213-
"github.com/pkg/errors.TestFormatWithStack\n" +
214-
"\t.+/github.com/pkg/errors/format_test.go:205"},
209+
"github.com/chigopher/errors.TestFormatWithStack\n" +
210+
"\t.+/format_test.go:205",
211+
"github.com/chigopher/errors.TestFormatWithStack\n" +
212+
"\t.+/format_test.go:205",
213+
"github.com/chigopher/errors.TestFormatWithStack\n" +
214+
"\t.+/format_test.go:205"},
215215
}, {
216216
WithStack(Errorf("error%d", 1)),
217217
"%+v",
218218
[]string{"error1",
219-
"github.com/pkg/errors.TestFormatWithStack\n" +
220-
"\t.+/github.com/pkg/errors/format_test.go:216",
221-
"github.com/pkg/errors.TestFormatWithStack\n" +
222-
"\t.+/github.com/pkg/errors/format_test.go:216"},
219+
"github.com/chigopher/errors.TestFormatWithStack\n" +
220+
"\t.+/format_test.go:216",
221+
"github.com/chigopher/errors.TestFormatWithStack\n" +
222+
"\t.+/format_test.go:216"},
223223
}}
224224

225225
for i, tt := range tests {
@@ -245,8 +245,8 @@ func TestFormatWithMessage(t *testing.T) {
245245
"%+v",
246246
[]string{
247247
"error",
248-
"github.com/pkg/errors.TestFormatWithMessage\n" +
249-
"\t.+/github.com/pkg/errors/format_test.go:244",
248+
"github.com/chigopher/errors.TestFormatWithMessage\n" +
249+
"\t.+/format_test.go:244",
250250
"error2"},
251251
}, {
252252
WithMessage(io.EOF, "addition1"),
@@ -272,33 +272,33 @@ func TestFormatWithMessage(t *testing.T) {
272272
Wrap(WithMessage(io.EOF, "error1"), "error2"),
273273
"%+v",
274274
[]string{"EOF", "error1", "error2",
275-
"github.com/pkg/errors.TestFormatWithMessage\n" +
276-
"\t.+/github.com/pkg/errors/format_test.go:272"},
275+
"github.com/chigopher/errors.TestFormatWithMessage\n" +
276+
"\t.+/format_test.go:272"},
277277
}, {
278278
WithMessage(Errorf("error%d", 1), "error2"),
279279
"%+v",
280280
[]string{"error1",
281-
"github.com/pkg/errors.TestFormatWithMessage\n" +
282-
"\t.+/github.com/pkg/errors/format_test.go:278",
281+
"github.com/chigopher/errors.TestFormatWithMessage\n" +
282+
"\t.+/format_test.go:278",
283283
"error2"},
284284
}, {
285285
WithMessage(WithStack(io.EOF), "error"),
286286
"%+v",
287287
[]string{
288288
"EOF",
289-
"github.com/pkg/errors.TestFormatWithMessage\n" +
290-
"\t.+/github.com/pkg/errors/format_test.go:285",
289+
"github.com/chigopher/errors.TestFormatWithMessage\n" +
290+
"\t.+/format_test.go:285",
291291
"error"},
292292
}, {
293293
WithMessage(Wrap(WithStack(io.EOF), "inside-error"), "outside-error"),
294294
"%+v",
295295
[]string{
296296
"EOF",
297-
"github.com/pkg/errors.TestFormatWithMessage\n" +
298-
"\t.+/github.com/pkg/errors/format_test.go:293",
297+
"github.com/chigopher/errors.TestFormatWithMessage\n" +
298+
"\t.+/format_test.go:293",
299299
"inside-error",
300-
"github.com/pkg/errors.TestFormatWithMessage\n" +
301-
"\t.+/github.com/pkg/errors/format_test.go:293",
300+
"github.com/chigopher/errors.TestFormatWithMessage\n" +
301+
"\t.+/format_test.go:293",
302302
"outside-error"},
303303
}}
304304

@@ -314,12 +314,12 @@ func TestFormatGeneric(t *testing.T) {
314314
}{
315315
{New("new-error"), []string{
316316
"new-error",
317-
"github.com/pkg/errors.TestFormatGeneric\n" +
318-
"\t.+/github.com/pkg/errors/format_test.go:315"},
317+
"github.com/chigopher/errors.TestFormatGeneric\n" +
318+
"\t.+/format_test.go:315"},
319319
}, {Errorf("errorf-error"), []string{
320320
"errorf-error",
321-
"github.com/pkg/errors.TestFormatGeneric\n" +
322-
"\t.+/github.com/pkg/errors/format_test.go:319"},
321+
"github.com/chigopher/errors.TestFormatGeneric\n" +
322+
"\t.+/format_test.go:319"},
323323
}, {errors.New("errors-new-error"), []string{
324324
"errors-new-error"},
325325
},
@@ -332,22 +332,22 @@ func TestFormatGeneric(t *testing.T) {
332332
}, {
333333
func(err error) error { return WithStack(err) },
334334
[]string{
335-
"github.com/pkg/errors.(func·002|TestFormatGeneric.func2)\n\t" +
336-
".+/github.com/pkg/errors/format_test.go:333",
335+
"github.com/chigopher/errors.(func·002|TestFormatGeneric.func2)\n\t" +
336+
".+/format_test.go:333",
337337
},
338338
}, {
339339
func(err error) error { return Wrap(err, "wrap-error") },
340340
[]string{
341341
"wrap-error",
342-
"github.com/pkg/errors.(func·003|TestFormatGeneric.func3)\n\t" +
343-
".+/github.com/pkg/errors/format_test.go:339",
342+
"github.com/chigopher/errors.(func·003|TestFormatGeneric.func3)\n\t" +
343+
".+/format_test.go:339",
344344
},
345345
}, {
346346
func(err error) error { return Wrapf(err, "wrapf-error%d", 1) },
347347
[]string{
348348
"wrapf-error1",
349-
"github.com/pkg/errors.(func·004|TestFormatGeneric.func4)\n\t" +
350-
".+/github.com/pkg/errors/format_test.go:346",
349+
"github.com/chigopher/errors.(func·004|TestFormatGeneric.func4)\n\t" +
350+
".+/format_test.go:346",
351351
},
352352
},
353353
}
@@ -373,10 +373,10 @@ func TestFormatWrappedNew(t *testing.T) {
373373
wrappedNew("error"),
374374
"%+v",
375375
"error\n" +
376-
"github.com/pkg/errors.wrappedNew\n" +
377-
"\t.+/github.com/pkg/errors/format_test.go:364\n" +
378-
"github.com/pkg/errors.TestFormatWrappedNew\n" +
379-
"\t.+/github.com/pkg/errors/format_test.go:373",
376+
"github.com/chigopher/errors.wrappedNew\n" +
377+
"\t.+/format_test.go:364\n" +
378+
"github.com/chigopher/errors.TestFormatWrappedNew\n" +
379+
"\t.+/format_test.go:373",
380380
}}
381381

382382
for i, tt := range tests {
@@ -409,22 +409,21 @@ func testFormatRegexp(t *testing.T, n int, arg interface{}, format, want string)
409409
var stackLineR = regexp.MustCompile(`\.`)
410410

411411
// parseBlocks parses input into a slice, where:
412-
// - incase entry contains a newline, its a stacktrace
413-
// - incase entry contains no newline, its a solo line.
412+
// - incase entry contains a newline, its a stacktrace
413+
// - incase entry contains no newline, its a solo line.
414414
//
415415
// Detecting stack boundaries only works incase the WithStack-calls are
416416
// to be found on the same line, thats why it is optionally here.
417417
//
418418
// Example use:
419419
//
420-
// for _, e := range blocks {
421-
// if strings.ContainsAny(e, "\n") {
422-
// // Match as stack
423-
// } else {
424-
// // Match as line
425-
// }
426-
// }
427-
//
420+
// for _, e := range blocks {
421+
// if strings.ContainsAny(e, "\n") {
422+
// // Match as stack
423+
// } else {
424+
// // Match as line
425+
// }
426+
// }
428427
func parseBlocks(input string, detectStackboundaries bool) ([]string, error) {
429428
var blocks []string
430429

0 commit comments

Comments
 (0)