Skip to content

Commit

Permalink
Exclude fuzz testing from pre-1.18 toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
brackendawson committed Jan 28, 2024
1 parent a8f0586 commit 46e2a5c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
22 changes: 22 additions & 0 deletions calendar_fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//go:build go1.18
// +build go1.18

package ics

import (
"bytes"
"os"
"testing"

"github.com/stretchr/testify/require"
)

func FuzzParseCalendar(f *testing.F) {
ics, err := os.ReadFile("testdata/timeparsing.ics")
require.NoError(f, err)
f.Add(ics)
f.Fuzz(func(t *testing.T, ics []byte) {
_, err := ParseCalendar(bytes.NewReader(ics))
t.Log(err)
})
}
15 changes: 1 addition & 14 deletions calendar_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ics

import (
"bytes"
"github.com/stretchr/testify/assert"
"io"
"io/ioutil"
"os"
Expand All @@ -11,9 +11,6 @@ import (
"testing"
"time"
"unicode/utf8"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestTimeParsing(t *testing.T) {
Expand Down Expand Up @@ -363,13 +360,3 @@ func TestIssue52(t *testing.T) {
t.Fatalf("cannot read test directory: %v", err)
}
}

func FuzzParseCalendar(f *testing.F) {
ics, err := os.ReadFile("testdata/timeparsing.ics")
require.NoError(f, err)
f.Add(ics)
f.Fuzz(func(t *testing.T, ics []byte) {
_, err := ParseCalendar(bytes.NewReader(ics))
t.Log(err)
})
}

0 comments on commit 46e2a5c

Please sign in to comment.