diff --git a/internal/test_helpers/fixtures/streams/pass b/internal/test_helpers/fixtures/streams/pass index 6e6cf8f..3b6d7f7 100644 --- a/internal/test_helpers/fixtures/streams/pass +++ b/internal/test_helpers/fixtures/streams/pass @@ -2,11 +2,11 @@ Debug = true [stage-44] Running tests for Stage #44: xu1 [stage-44] $ ./spawn_redis_server.sh -[stage-44] $ redis-cli xadd "pear" "0-1" "temperature 70" -[stage-44] Received response: ""0-1"" +[stage-44] $ redis-cli xadd pear 0-1 temperature 70 +[stage-44] Received response: "0-1" [stage-44] $ redis-cli xread block 0 streams pear 0-1 -[stage-44] $ redis-cli xadd "pear" "0-2" "temperature 70" -[stage-44] Received response: ""0-2"" +[stage-44] $ redis-cli xadd pear 0-2 temperature 70 +[stage-44] Received response: "0-2" [stage-44] Received response: "[ [stage-44]  { [stage-44]  "Stream": "pear", @@ -26,11 +26,11 @@ Debug = true [stage-43] Running tests for Stage #43: hw1 [stage-43] $ ./spawn_redis_server.sh -[stage-43] $ redis-cli xadd "raspberry" "0-1" "temperature 74" -[stage-43] Received response: ""0-1"" +[stage-43] $ redis-cli xadd raspberry 0-1 temperature 74 +[stage-43] Received response: "0-1" [stage-43] $ redis-cli xread block 0 streams raspberry 0-1 -[stage-43] $ redis-cli xadd "raspberry" "0-2" "temperature 74" -[stage-43] Received response: ""0-2"" +[stage-43] $ redis-cli xadd raspberry 0-2 temperature 74 +[stage-43] Received response: "0-2" [stage-43] Received response: "[ [stage-43]  { [stage-43]  "Stream": "raspberry", @@ -50,11 +50,11 @@ Debug = true [stage-42] Running tests for Stage #42: bs1 [stage-42] $ ./spawn_redis_server.sh -[stage-42] $ redis-cli xadd "pear" "0-1" "temperature 30" -[stage-42] Received response: ""0-1"" +[stage-42] $ redis-cli xadd pear 0-1 temperature 30 +[stage-42] Received response: "0-1" [stage-42] $ redis-cli xread block 1000 streams pear 0-1 -[stage-42] $ redis-cli xadd "pear" "0-2" "temperature 30" -[stage-42] Received response: ""0-2"" +[stage-42] $ redis-cli xadd pear 0-2 temperature 30 +[stage-42] Received response: "0-2" [stage-42] Received response: "[ [stage-42]  { [stage-42]  "Stream": "pear", @@ -76,11 +76,11 @@ Debug = true [stage-41] Running tests for Stage #41: ru9 [stage-41] $ ./spawn_redis_server.sh -[stage-41] $ redis-cli xadd "blueberry" "0-1" "temperature 24" -[stage-41] Received response: ""0-1"" -[stage-41] $ redis-cli xadd "banana" "0-2" "humidity 61" -[stage-41] Received response: ""0-2"" -[stage-41] $ redis-cli xread streams "blueberry banana 0-0 0-1" +[stage-41] $ redis-cli xadd blueberry 0-1 temperature 24 +[stage-41] Received response: "0-1" +[stage-41] $ redis-cli xadd banana 0-2 humidity 61 +[stage-41] Received response: "0-2" +[stage-41] $ redis-cli xread streams blueberry banana 0-0 0-1 [stage-41] Received response: "[ [stage-41]  { [stage-41]  "Stream": "blueberry", @@ -111,9 +111,9 @@ Debug = true [stage-40] Running tests for Stage #40: um0 [stage-40] $ ./spawn_redis_server.sh -[stage-40] $ redis-cli xadd "grape" "0-1" "temperature 54" -[stage-40] Received response: ""0-1"" -[stage-40] $ redis-cli xread streams "grape 0-0" +[stage-40] $ redis-cli xadd grape 0-1 temperature 54 +[stage-40] Received response: "0-1" +[stage-40] $ redis-cli xread streams grape 0-0 [stage-40] Received response: "[ [stage-40]  { [stage-40]  "Stream": "grape", @@ -133,13 +133,13 @@ Debug = true [stage-39] Running tests for Stage #39: fs1 [stage-39] $ ./spawn_redis_server.sh -[stage-39] $ redis-cli xadd "apple" "0-1" "foo bar" -[stage-39] Received response: ""0-1"" -[stage-39] $ redis-cli xadd "apple" "0-2" "foo bar" -[stage-39] Received response: ""0-2"" -[stage-39] $ redis-cli xadd "apple" "0-3" "foo bar" -[stage-39] Received response: ""0-3"" -[stage-39] $ redis-cli xrange "apple" 0-2 + +[stage-39] $ redis-cli xadd apple 0-1 foo bar +[stage-39] Received response: "0-1" +[stage-39] $ redis-cli xadd apple 0-2 foo bar +[stage-39] Received response: "0-2" +[stage-39] $ redis-cli xadd apple 0-3 foo bar +[stage-39] Received response: "0-3" +[stage-39] $ redis-cli xrange apple 0-2 + [stage-39] Received response: "[ [stage-39]  { [stage-39]  "ID": "0-2", @@ -160,13 +160,13 @@ Debug = true [stage-38] Running tests for Stage #38: yp1 [stage-38] $ ./spawn_redis_server.sh -[stage-38] $ redis-cli xadd "banana" "0-1" "foo bar" -[stage-38] Received response: ""0-1"" -[stage-38] $ redis-cli xadd "banana" "0-2" "foo bar" -[stage-38] Received response: ""0-2"" -[stage-38] $ redis-cli xadd "banana" "0-3" "foo bar" -[stage-38] Received response: ""0-3"" -[stage-38] $ redis-cli xrange "banana" - "0-2" +[stage-38] $ redis-cli xadd banana 0-1 foo bar +[stage-38] Received response: "0-1" +[stage-38] $ redis-cli xadd banana 0-2 foo bar +[stage-38] Received response: "0-2" +[stage-38] $ redis-cli xadd banana 0-3 foo bar +[stage-38] Received response: "0-3" +[stage-38] $ redis-cli xrange banana - 0-2 [stage-38] Received response: "[ [stage-38]  { [stage-38]  "ID": "0-1", @@ -187,13 +187,13 @@ Debug = true [stage-37] Running tests for Stage #37: zx1 [stage-37] $ ./spawn_redis_server.sh -[stage-37] $ redis-cli xadd "grape" "0-1" "foo bar" -[stage-37] Received response: ""0-1"" -[stage-37] $ redis-cli xadd "grape" "0-2" "foo bar" -[stage-37] Received response: ""0-2"" -[stage-37] $ redis-cli xadd "grape" "0-3" "foo bar" -[stage-37] Received response: ""0-3"" -[stage-37] $ redis-cli xrange "grape" 0-2 "0-3" +[stage-37] $ redis-cli xadd grape 0-1 foo bar +[stage-37] Received response: "0-1" +[stage-37] $ redis-cli xadd grape 0-2 foo bar +[stage-37] Received response: "0-2" +[stage-37] $ redis-cli xadd grape 0-3 foo bar +[stage-37] Received response: "0-3" +[stage-37] $ redis-cli xrange grape 0-2 0-3 [stage-37] Received response: "[ [stage-37]  { [stage-37]  "ID": "0-2", diff --git a/internal/test_helpers/fixtures/transactions/pass b/internal/test_helpers/fixtures/transactions/pass index f296f30..63b7efe 100644 --- a/internal/test_helpers/fixtures/transactions/pass +++ b/internal/test_helpers/fixtures/transactions/pass @@ -369,11 +369,11 @@ Debug = true [stage-44] Running tests for Stage #44: xu1 [stage-44] $ ./spawn_redis_server.sh -[stage-44] $ redis-cli xadd "apple" "0-1" "temperature 10" -[stage-44] Received response: ""0-1"" +[stage-44] $ redis-cli xadd apple 0-1 temperature 10 +[stage-44] Received response: "0-1" [stage-44] $ redis-cli xread block 0 streams apple 0-1 -[stage-44] $ redis-cli xadd "apple" "0-2" "temperature 10" -[stage-44] Received response: ""0-2"" +[stage-44] $ redis-cli xadd apple 0-2 temperature 10 +[stage-44] Received response: "0-2" [stage-44] Received response: "[ [stage-44]  { [stage-44]  "Stream": "apple", @@ -393,11 +393,11 @@ Debug = true [stage-43] Running tests for Stage #43: hw1 [stage-43] $ ./spawn_redis_server.sh -[stage-43] $ redis-cli xadd "banana" "0-1" "temperature 91" -[stage-43] Received response: ""0-1"" +[stage-43] $ redis-cli xadd banana 0-1 temperature 91 +[stage-43] Received response: "0-1" [stage-43] $ redis-cli xread block 0 streams banana 0-1 -[stage-43] $ redis-cli xadd "banana" "0-2" "temperature 91" -[stage-43] Received response: ""0-2"" +[stage-43] $ redis-cli xadd banana 0-2 temperature 91 +[stage-43] Received response: "0-2" [stage-43] Received response: "[ [stage-43]  { [stage-43]  "Stream": "banana", @@ -417,11 +417,11 @@ Debug = true [stage-42] Running tests for Stage #42: bs1 [stage-42] $ ./spawn_redis_server.sh -[stage-42] $ redis-cli xadd "orange" "0-1" "temperature 2" -[stage-42] Received response: ""0-1"" +[stage-42] $ redis-cli xadd orange 0-1 temperature 2 +[stage-42] Received response: "0-1" [stage-42] $ redis-cli xread block 1000 streams orange 0-1 -[stage-42] $ redis-cli xadd "orange" "0-2" "temperature 2" -[stage-42] Received response: ""0-2"" +[stage-42] $ redis-cli xadd orange 0-2 temperature 2 +[stage-42] Received response: "0-2" [stage-42] Received response: "[ [stage-42]  { [stage-42]  "Stream": "orange", @@ -443,11 +443,11 @@ Debug = true [stage-41] Running tests for Stage #41: ru9 [stage-41] $ ./spawn_redis_server.sh -[stage-41] $ redis-cli xadd "pineapple" "0-1" "temperature 99" -[stage-41] Received response: ""0-1"" -[stage-41] $ redis-cli xadd "orange" "0-2" "humidity 37" -[stage-41] Received response: ""0-2"" -[stage-41] $ redis-cli xread streams "pineapple orange 0-0 0-1" +[stage-41] $ redis-cli xadd pineapple 0-1 temperature 99 +[stage-41] Received response: "0-1" +[stage-41] $ redis-cli xadd orange 0-2 humidity 37 +[stage-41] Received response: "0-2" +[stage-41] $ redis-cli xread streams pineapple orange 0-0 0-1 [stage-41] Received response: "[ [stage-41]  { [stage-41]  "Stream": "pineapple", @@ -478,9 +478,9 @@ Debug = true [stage-40] Running tests for Stage #40: um0 [stage-40] $ ./spawn_redis_server.sh -[stage-40] $ redis-cli xadd "apple" "0-1" "temperature 88" -[stage-40] Received response: ""0-1"" -[stage-40] $ redis-cli xread streams "apple 0-0" +[stage-40] $ redis-cli xadd apple 0-1 temperature 88 +[stage-40] Received response: "0-1" +[stage-40] $ redis-cli xread streams apple 0-0 [stage-40] Received response: "[ [stage-40]  { [stage-40]  "Stream": "apple", @@ -500,15 +500,15 @@ Debug = true [stage-39] Running tests for Stage #39: fs1 [stage-39] $ ./spawn_redis_server.sh -[stage-39] $ redis-cli xadd "apple" "0-1" "foo bar" -[stage-39] Received response: ""0-1"" -[stage-39] $ redis-cli xadd "apple" "0-2" "foo bar" -[stage-39] Received response: ""0-2"" -[stage-39] $ redis-cli xadd "apple" "0-3" "foo bar" -[stage-39] Received response: ""0-3"" -[stage-39] $ redis-cli xadd "apple" "0-4" "foo bar" -[stage-39] Received response: ""0-4"" -[stage-39] $ redis-cli xrange "apple" 0-2 + +[stage-39] $ redis-cli xadd apple 0-1 foo bar +[stage-39] Received response: "0-1" +[stage-39] $ redis-cli xadd apple 0-2 foo bar +[stage-39] Received response: "0-2" +[stage-39] $ redis-cli xadd apple 0-3 foo bar +[stage-39] Received response: "0-3" +[stage-39] $ redis-cli xadd apple 0-4 foo bar +[stage-39] Received response: "0-4" +[stage-39] $ redis-cli xrange apple 0-2 + [stage-39] Received response: "[ [stage-39]  { [stage-39]  "ID": "0-2", @@ -535,15 +535,15 @@ Debug = true [stage-38] Running tests for Stage #38: yp1 [stage-38] $ ./spawn_redis_server.sh -[stage-38] $ redis-cli xadd "blueberry" "0-1" "foo bar" -[stage-38] Received response: ""0-1"" -[stage-38] $ redis-cli xadd "blueberry" "0-2" "foo bar" -[stage-38] Received response: ""0-2"" -[stage-38] $ redis-cli xadd "blueberry" "0-3" "foo bar" -[stage-38] Received response: ""0-3"" -[stage-38] $ redis-cli xadd "blueberry" "0-4" "foo bar" -[stage-38] Received response: ""0-4"" -[stage-38] $ redis-cli xrange "blueberry" - "0-3" +[stage-38] $ redis-cli xadd blueberry 0-1 foo bar +[stage-38] Received response: "0-1" +[stage-38] $ redis-cli xadd blueberry 0-2 foo bar +[stage-38] Received response: "0-2" +[stage-38] $ redis-cli xadd blueberry 0-3 foo bar +[stage-38] Received response: "0-3" +[stage-38] $ redis-cli xadd blueberry 0-4 foo bar +[stage-38] Received response: "0-4" +[stage-38] $ redis-cli xrange blueberry - 0-3 [stage-38] Received response: "[ [stage-38]  { [stage-38]  "ID": "0-1", @@ -570,15 +570,15 @@ Debug = true [stage-37] Running tests for Stage #37: zx1 [stage-37] $ ./spawn_redis_server.sh -[stage-37] $ redis-cli xadd "grape" "0-1" "foo bar" -[stage-37] Received response: ""0-1"" -[stage-37] $ redis-cli xadd "grape" "0-2" "foo bar" -[stage-37] Received response: ""0-2"" -[stage-37] $ redis-cli xadd "grape" "0-3" "foo bar" -[stage-37] Received response: ""0-3"" -[stage-37] $ redis-cli xadd "grape" "0-4" "foo bar" -[stage-37] Received response: ""0-4"" -[stage-37] $ redis-cli xrange "grape" 0-2 "0-4" +[stage-37] $ redis-cli xadd grape 0-1 foo bar +[stage-37] Received response: "0-1" +[stage-37] $ redis-cli xadd grape 0-2 foo bar +[stage-37] Received response: "0-2" +[stage-37] $ redis-cli xadd grape 0-3 foo bar +[stage-37] Received response: "0-3" +[stage-37] $ redis-cli xadd grape 0-4 foo bar +[stage-37] Received response: "0-4" +[stage-37] $ redis-cli xrange grape 0-2 0-4 [stage-37] Received response: "[ [stage-37]  { [stage-37]  "ID": "0-2", diff --git a/internal/test_streams_xadd.go b/internal/test_streams_xadd.go index 9b29d90..1c35e24 100644 --- a/internal/test_streams_xadd.go +++ b/internal/test_streams_xadd.go @@ -30,7 +30,7 @@ func (t *XADDTest) Run(client *redis.Client, logger *logger.Logger) error { values = append(values, key, fmt.Sprintf("%v", value)) } - logger.Infof("$ redis-cli xadd %q %q %q", t.streamKey, t.id, strings.Join(values, " ")) + logger.Infof("$ redis-cli xadd %v %v %v", t.streamKey, t.id, strings.Join(values, " ")) resp, err := client.XAdd(&redis.XAddArgs{ Stream: t.streamKey, @@ -48,18 +48,18 @@ func (t *XADDTest) Run(client *redis.Client, logger *logger.Logger) error { return fmt.Errorf("Expected %q, got %q", t.expectedError, err.Error()) } - logger.Successf("Received error: \"%q\"", err.Error()) + logger.Successf("Received error: %q", err.Error()) return nil } if resp != t.expectedResponse && t.expectedError != "" { - logger.Infof("Received response: \"%q\"", resp) + logger.Infof("Received response: %q", resp) return fmt.Errorf("Expected an error as the response, got %q", resp) } else if resp != t.expectedResponse { - logger.Infof("Received response: \"%q\"", resp) + logger.Infof("Received response: %q", resp) return fmt.Errorf("Expected %q, got %q", t.expectedResponse, resp) } else { - logger.Successf("Received response: \"%q\"", resp) + logger.Successf("Received response: %q", resp) } return nil diff --git a/internal/test_streams_xrange.go b/internal/test_streams_xrange.go index 3cc42dc..70c11af 100644 --- a/internal/test_streams_xrange.go +++ b/internal/test_streams_xrange.go @@ -3,10 +3,11 @@ package internal import ( "encoding/json" "fmt" - "github.com/codecrafters-io/redis-tester/internal/redis_executable" "reflect" "strconv" + "github.com/codecrafters-io/redis-tester/internal/redis_executable" + testerutils_random "github.com/codecrafters-io/tester-utils/random" "github.com/codecrafters-io/tester-utils/test_case_harness" "github.com/go-redis/redis" @@ -55,7 +56,7 @@ func testStreamsXrange(stageHarness *test_case_harness.TestCaseHarness) error { maxID := "0-" + strconv.Itoa(randomNumber) expectedResp = expectedResp[1:] - logger.Infof("$ redis-cli xrange %q 0-2 %q", randomKey, maxID) + logger.Infof("$ redis-cli xrange %v 0-2 %v", randomKey, maxID) resp, err := client.XRange(randomKey, "0-2", maxID).Result() if err != nil { diff --git a/internal/test_streams_xrange_max_id.go b/internal/test_streams_xrange_max_id.go index 652cdb4..5011ebd 100644 --- a/internal/test_streams_xrange_max_id.go +++ b/internal/test_streams_xrange_max_id.go @@ -3,10 +3,11 @@ package internal import ( "encoding/json" "fmt" - "github.com/codecrafters-io/redis-tester/internal/redis_executable" "reflect" "strconv" + "github.com/codecrafters-io/redis-tester/internal/redis_executable" + testerutils_random "github.com/codecrafters-io/tester-utils/random" "github.com/codecrafters-io/tester-utils/test_case_harness" "github.com/go-redis/redis" @@ -56,7 +57,7 @@ func testStreamsXrangeMaxID(stageHarness *test_case_harness.TestCaseHarness) err }) } - logger.Infof("$ redis-cli xrange %q 0-2 +", randomKey) + logger.Infof("$ redis-cli xrange %v 0-2 +", randomKey) resp, err := client.XRange(randomKey, "0-2", "+").Result() if err != nil { diff --git a/internal/test_streams_xrange_min_id.go b/internal/test_streams_xrange_min_id.go index ca6506c..07c161e 100644 --- a/internal/test_streams_xrange_min_id.go +++ b/internal/test_streams_xrange_min_id.go @@ -3,10 +3,11 @@ package internal import ( "encoding/json" "fmt" - "github.com/codecrafters-io/redis-tester/internal/redis_executable" "reflect" "strconv" + "github.com/codecrafters-io/redis-tester/internal/redis_executable" + testerutils_random "github.com/codecrafters-io/tester-utils/random" "github.com/codecrafters-io/tester-utils/test_case_harness" "github.com/go-redis/redis" @@ -58,7 +59,7 @@ func testStreamsXrangeMinID(stageHarness *test_case_harness.TestCaseHarness) err }) } - logger.Infof("$ redis-cli xrange %q - %q", randomKey, maxID) + logger.Infof("$ redis-cli xrange %v - %v", randomKey, maxID) resp, err := client.XRange(randomKey, "-", maxID).Result() if err != nil { diff --git a/internal/test_streams_xread.go b/internal/test_streams_xread.go index 349f820..4b15269 100644 --- a/internal/test_streams_xread.go +++ b/internal/test_streams_xread.go @@ -27,7 +27,7 @@ func (t *XREADTest) Run(client *redis.Client, logger *logger.Logger) error { var err error if t.block == nil { - logger.Infof("$ redis-cli xread streams %q", strings.Join(t.streams, " ")) + logger.Infof("$ redis-cli xread streams %v", strings.Join(t.streams, " ")) resp, err = client.XRead(&redis.XReadArgs{ Streams: t.streams,