Skip to content

Commit b3e5bf4

Browse files
committed
Parser: move example code to examples_test.go
1 parent e9cf7cd commit b3e5bf4

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

readme_example_test.go renamed to examples_test.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ import (
66
"testing"
77

88
dem "github.com/markus-wa/demoinfocs-golang"
9-
events "github.com/markus-wa/demoinfocs-golang/events"
9+
"github.com/markus-wa/demoinfocs-golang/events"
1010
)
1111

12-
func TestReadmeExample(t *testing.T) {
13-
if testing.Short() {
14-
t.Skip("skipping test")
15-
}
16-
17-
f, err := os.Open(defaultDemPath)
12+
/*
13+
This will print all kills of a demo in the format '[[killer]] <[[weapon]] [(HS)] [(WB)]> [[victim]]'
14+
*/
15+
func ExampleParser() {
16+
f, err := os.Open("cs-demos/default.dem")
1817
if err != nil {
1918
panic(err)
2019
}
@@ -41,3 +40,10 @@ func TestReadmeExample(t *testing.T) {
4140
panic(err)
4241
}
4342
}
43+
44+
func TestExamplesWithoutOutput(t *testing.T) {
45+
if testing.Short() {
46+
t.Skip("skipping long running test")
47+
}
48+
ExampleParser()
49+
}

0 commit comments

Comments
 (0)