From 9a15494940ff8c8c9e672e4a12916ad7f9065407 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Wed, 3 Jul 2024 12:12:50 -0500 Subject: [PATCH] test ci --- relayer/fail_test.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 relayer/fail_test.go diff --git a/relayer/fail_test.go b/relayer/fail_test.go new file mode 100644 index 00000000..d46c7636 --- /dev/null +++ b/relayer/fail_test.go @@ -0,0 +1,40 @@ +package relayer + +import ( + "errors" + "os" + "sync" + "testing" +) + +func TestFail(t *testing.T) { + if testing.Short() { + t.Skip() + } + t.Fatal("fake failure") +} + +func TestRace(t *testing.T) { + var v int + var wg sync.WaitGroup + wg.Add(100) + for i := 0; i < 100; i++ { + go func() { + defer wg.Done() + v++ + v-- + }() + } + wg.Wait() + t.Log(v) +} + +func TestLint(t *testing.T) { + const UnusedVar = 1 // lint should complain for unused variable + const ALL_CAPS = 10 // should be AllCaps + err := os.ErrNotExist + if err == os.ErrNotExist { // should use errors.Is + err := errors.New("fake error") // shadowed variable + t.Log(err) + } +}