From f80f420e524171b7e68be37e128e34d4b0f4f779 Mon Sep 17 00:00:00 2001 From: Adam Luzsi Date: Mon, 3 Jun 2024 22:29:15 +0200 Subject: [PATCH] fmt --- assert/AnyOf_test.go | 3 ++- assert/Eventually.go | 2 +- assert/Eventually_test.go | 3 ++- assert/equal.go | 3 ++- assert/message_test.go | 5 +++-- assert/pkgfunc.go | 2 +- clock/Clock_test.go | 3 ++- internal/doubles/TB.go | 3 ++- internal/reflects/deepequal.go | 3 ++- internal/reflects/deepequal_test.go | 5 +++-- let/As.go | 3 ++- let/As_test.go | 5 +++-- pp/Format.go | 3 ++- pp/PP.go | 3 ++- pp/examples_test.go | 1 + random/Unique.go | 3 ++- random/Unique_test.go | 3 ++- random/pick_test.go | 5 +++-- seed_test.go | 5 +++-- utils.go | 3 ++- utils_test.go | 9 +++++---- 21 files changed, 47 insertions(+), 28 deletions(-) diff --git a/assert/AnyOf_test.go b/assert/AnyOf_test.go index b54413f..223f344 100644 --- a/assert/AnyOf_test.go +++ b/assert/AnyOf_test.go @@ -1,9 +1,10 @@ package assert_test import ( + "testing" + "go.llib.dev/testcase/random" "go.llib.dev/testcase/sandbox" - "testing" "go.llib.dev/testcase" "go.llib.dev/testcase/assert" diff --git a/assert/Eventually.go b/assert/Eventually.go index e13f28b..cbd24b0 100644 --- a/assert/Eventually.go +++ b/assert/Eventually.go @@ -43,7 +43,7 @@ func (fn RetryStrategyFunc) While(condition func() bool) { fn(condition) } // In case expectations are failed, it will retry the assertion block using the RetryStrategy. // The last failed assertion results would be published to the received testing.TB. // Calling multiple times the assertion function block content should be a safe and repeatable operation. -func (r Retry) Assert(tb testing.TB, blk func(it It)) { +func (r Retry) Assert(tb testing.TB, blk func(t It)) { tb.Helper() var lastRecorder *doubles.RecorderTB diff --git a/assert/Eventually_test.go b/assert/Eventually_test.go index 4bc2467..d9383db 100644 --- a/assert/Eventually_test.go +++ b/assert/Eventually_test.go @@ -2,10 +2,11 @@ package assert_test import ( "fmt" - "go.llib.dev/testcase/let" "testing" "time" + "go.llib.dev/testcase/let" + "go.llib.dev/testcase/assert" "go.llib.dev/testcase/internal/doubles" "go.llib.dev/testcase/random" diff --git a/assert/equal.go b/assert/equal.go index 369a766..1364e23 100644 --- a/assert/equal.go +++ b/assert/equal.go @@ -2,12 +2,13 @@ package assert import ( "fmt" - "go.llib.dev/testcase/internal/reflects" "math/big" "net" "reflect" "testing" "time" + + "go.llib.dev/testcase/internal/reflects" ) func eq(tb testing.TB, exp, act any) bool { diff --git a/assert/message_test.go b/assert/message_test.go index ef57991..ce7c13b 100644 --- a/assert/message_test.go +++ b/assert/message_test.go @@ -1,11 +1,12 @@ package assert_test import ( + "strings" + "testing" + "go.llib.dev/testcase/assert" "go.llib.dev/testcase/internal/doubles" "go.llib.dev/testcase/random" - "strings" - "testing" ) func ExampleMessage() { diff --git a/assert/pkgfunc.go b/assert/pkgfunc.go index 3653a29..fa8fcbf 100644 --- a/assert/pkgfunc.go +++ b/assert/pkgfunc.go @@ -122,7 +122,7 @@ func NotMatchRegexp[T ~string | []byte](tb testing.TB, v T, expr string, msg ... Must(tb).NotMatchRegexp(string(v), expr, msg...) } -func Eventually[T time.Duration | int](tb testing.TB, durationOrCount T, blk func(it It)) { +func Eventually[T time.Duration | int](tb testing.TB, durationOrCount T, blk func(t It)) { tb.Helper() Must(tb).Eventually(durationOrCount, blk) } diff --git a/clock/Clock_test.go b/clock/Clock_test.go index ca8542d..e82e1b7 100644 --- a/clock/Clock_test.go +++ b/clock/Clock_test.go @@ -2,10 +2,11 @@ package clock_test import ( "context" - "go.llib.dev/testcase/let" "testing" "time" + "go.llib.dev/testcase/let" + "go.llib.dev/testcase" "go.llib.dev/testcase/assert" "go.llib.dev/testcase/clock" diff --git a/internal/doubles/TB.go b/internal/doubles/TB.go index d0c6caf..21a80ac 100644 --- a/internal/doubles/TB.go +++ b/internal/doubles/TB.go @@ -3,13 +3,14 @@ package doubles import ( "bytes" "fmt" - "go.llib.dev/testcase/sandbox" "os" "runtime" "sync" "testing" "time" + "go.llib.dev/testcase/sandbox" + "go.llib.dev/testcase/internal/env" "go.llib.dev/testcase/internal/teardown" diff --git a/internal/reflects/deepequal.go b/internal/reflects/deepequal.go index a95f93c..846b480 100644 --- a/internal/reflects/deepequal.go +++ b/internal/reflects/deepequal.go @@ -1,8 +1,9 @@ package reflects import ( - "go.llib.dev/testcase/internal/teardown" "reflect" + + "go.llib.dev/testcase/internal/teardown" ) func DeepEqual(v1, v2 any) (bool, error) { diff --git a/internal/reflects/deepequal_test.go b/internal/reflects/deepequal_test.go index 8bf9f9b..91d9d8c 100644 --- a/internal/reflects/deepequal_test.go +++ b/internal/reflects/deepequal_test.go @@ -1,10 +1,11 @@ package reflects_test import ( - "go.llib.dev/testcase/internal/reflects" - "go.llib.dev/testcase/random" "reflect" "testing" + + "go.llib.dev/testcase/internal/reflects" + "go.llib.dev/testcase/random" ) func TestDeepEqual(t *testing.T) { diff --git a/let/As.go b/let/As.go index 359ce8d..28c3192 100644 --- a/let/As.go +++ b/let/As.go @@ -2,8 +2,9 @@ package let import ( "fmt" - "go.llib.dev/testcase" "reflect" + + "go.llib.dev/testcase" ) func As[To, From any](Var testcase.Var[From]) testcase.Var[To] { diff --git a/let/As_test.go b/let/As_test.go index 1e8cc43..c122801 100644 --- a/let/As_test.go +++ b/let/As_test.go @@ -1,12 +1,13 @@ package let_test import ( + "testing" + "time" + "go.llib.dev/testcase" "go.llib.dev/testcase/assert" "go.llib.dev/testcase/let" "go.llib.dev/testcase/sandbox" - "testing" - "time" ) func TestAs(t *testing.T) { diff --git a/pp/Format.go b/pp/Format.go index b0edc52..6c70eaa 100644 --- a/pp/Format.go +++ b/pp/Format.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "go.llib.dev/testcase/internal/reflects" "io" "reflect" "sort" @@ -12,6 +11,8 @@ import ( "sync" "time" "unicode/utf8" + + "go.llib.dev/testcase/internal/reflects" ) func Format(v any) string { diff --git a/pp/PP.go b/pp/PP.go index 60eac36..d0d9cbd 100644 --- a/pp/PP.go +++ b/pp/PP.go @@ -2,11 +2,12 @@ package pp import ( "fmt" - "go.llib.dev/testcase/internal/caller" "io" "os" "runtime" "strings" + + "go.llib.dev/testcase/internal/caller" ) var defaultWriter io.Writer = os.Stderr diff --git a/pp/examples_test.go b/pp/examples_test.go index 083c06e..43274a7 100644 --- a/pp/examples_test.go +++ b/pp/examples_test.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "fmt" + "go.llib.dev/testcase/pp" ) diff --git a/random/Unique.go b/random/Unique.go index f5fcc45..ffa09ed 100644 --- a/random/Unique.go +++ b/random/Unique.go @@ -1,9 +1,10 @@ package random import ( + "time" + "go.llib.dev/testcase/clock" "go.llib.dev/testcase/internal/reflects" - "time" ) // Unique function is a utility that helps with generating distinct values diff --git a/random/Unique_test.go b/random/Unique_test.go index 36c03bc..b094ea3 100644 --- a/random/Unique_test.go +++ b/random/Unique_test.go @@ -1,11 +1,12 @@ package random_test import ( + "testing" + "go.llib.dev/testcase/assert" "go.llib.dev/testcase/clock/timecop" "go.llib.dev/testcase/random" "go.llib.dev/testcase/sandbox" - "testing" ) func ExampleUnique() { diff --git a/random/pick_test.go b/random/pick_test.go index fc2a078..efaf412 100644 --- a/random/pick_test.go +++ b/random/pick_test.go @@ -1,12 +1,13 @@ package random_test import ( + "math/rand" + "testing" + "go.llib.dev/testcase" "go.llib.dev/testcase/assert" "go.llib.dev/testcase/let" "go.llib.dev/testcase/random" - "math/rand" - "testing" ) func ExamplePick_randomValuePicking() { diff --git a/seed_test.go b/seed_test.go index 8c1c39a..b4d552d 100644 --- a/seed_test.go +++ b/seed_test.go @@ -1,11 +1,12 @@ package testcase_test import ( + "strconv" + "testing" + "go.llib.dev/testcase" "go.llib.dev/testcase/assert" "go.llib.dev/testcase/internal/doubles" - "strconv" - "testing" ) func TestSpec_seed_T_Random(t *testing.T) { diff --git a/utils.go b/utils.go index 864f81a..53248f3 100644 --- a/utils.go +++ b/utils.go @@ -2,9 +2,10 @@ package testcase import ( "fmt" - "go.llib.dev/testcase/internal/env" "testing" "time" + + "go.llib.dev/testcase/internal/env" ) // SkipUntil is equivalent to SkipNow if the test is executing prior to the given deadline time. diff --git a/utils_test.go b/utils_test.go index 0ea0d06..32b034b 100644 --- a/utils_test.go +++ b/utils_test.go @@ -2,16 +2,17 @@ package testcase_test import ( "fmt" + "math/rand" + "os" + "testing" + "time" + "go.llib.dev/testcase" "go.llib.dev/testcase/assert" "go.llib.dev/testcase/internal/doubles" "go.llib.dev/testcase/internal/env" "go.llib.dev/testcase/random" "go.llib.dev/testcase/sandbox" - "math/rand" - "os" - "testing" - "time" ) func TestSkipUntil(t *testing.T) {