From 6a743cf5c48170af06e602ed72b7430e1474406a Mon Sep 17 00:00:00 2001 From: Konstantin Grachev Date: Wed, 8 May 2024 18:41:15 +0300 Subject: [PATCH] cs: fix --- lru/lru_test.go | 3 ++- semaphore/main_test.go | 1 - sort-cli/content.go | 3 ++- sort-cli/content_test.go | 6 ++++-- sort-cli/main_test.go | 15 ++++++++++----- unique-chars/main_test.go | 3 ++- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lru/lru_test.go b/lru/lru_test.go index b7b1efd..12e633b 100644 --- a/lru/lru_test.go +++ b/lru/lru_test.go @@ -2,9 +2,10 @@ package lru import ( "fmt" - "github.com/stretchr/testify/assert" "testing" "time" + + "github.com/stretchr/testify/assert" ) func TestTtl(t *testing.T) { diff --git a/semaphore/main_test.go b/semaphore/main_test.go index 3858ffe..f53da0c 100644 --- a/semaphore/main_test.go +++ b/semaphore/main_test.go @@ -5,5 +5,4 @@ import ( ) func TestPipe(t *testing.T) { - } diff --git a/sort-cli/content.go b/sort-cli/content.go index daf9f6e..aa36569 100644 --- a/sort-cli/content.go +++ b/sort-cli/content.go @@ -3,10 +3,11 @@ package main import ( "bufio" "errors" - "golang.org/x/exp/slices" "io" "log" "strings" + + "golang.org/x/exp/slices" ) // NL New line constant diff --git a/sort-cli/content_test.go b/sort-cli/content_test.go index 3858296..5929c13 100644 --- a/sort-cli/content_test.go +++ b/sort-cli/content_test.go @@ -1,9 +1,10 @@ package main import ( - "github.com/stretchr/testify/assert" "strings" "testing" + + "github.com/stretchr/testify/assert" ) const input = ` @@ -27,7 +28,8 @@ func TestUnique(t *testing.T) { Content string Expected string }{ - {"Unique", + { + "Unique", input, ` Zimbabwe diff --git a/sort-cli/main_test.go b/sort-cli/main_test.go index 2ae89e2..59b92a7 100644 --- a/sort-cli/main_test.go +++ b/sort-cli/main_test.go @@ -2,10 +2,11 @@ package main import ( "flag" - "github.com/stretchr/testify/assert" "os" "strings" "testing" + + "github.com/stretchr/testify/assert" ) func TestFlags(t *testing.T) { @@ -20,22 +21,26 @@ func TestFlags(t *testing.T) { ExpectedExit int ExpectedOutput string }{ - {"No flags", + { + "No flags", []string{"testdata/first"}, 0, "alabama barcelona\nbarcelona california\ncalifornia denver\ncalifornia denver\nамур брянск\nбелгород волгоград\nволгоград геленджик", }, - {"Reverse", + { + "Reverse", []string{"-r", "testdata/first"}, 0, "волгоград геленджик\nбелгород волгоград\nамур брянск\ncalifornia denver\ncalifornia denver\nbarcelona california\nalabama barcelona", }, - {"Unique", + { + "Unique", []string{"-u", "testdata/first"}, 0, "alabama barcelona\nbarcelona california\ncalifornia denver\nамур брянск\nбелгород волгоград\nволгоград геленджик", }, - {"Column 2", + { + "Column 2", []string{"-k=2", "testdata/first"}, 0, "alabama barcelona\nbarcelona california\ncalifornia denver\ncalifornia denver\nамур брянск\nбелгород волгоград\nволгоград геленджик", diff --git a/unique-chars/main_test.go b/unique-chars/main_test.go index 900cd05..08c9cc0 100644 --- a/unique-chars/main_test.go +++ b/unique-chars/main_test.go @@ -1,8 +1,9 @@ package uniqueschars import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestUnique(t *testing.T) {