Skip to content

Commit

Permalink
fix unit test for ParseQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Oct 7, 2023
1 parent 1287594 commit d791db0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions web/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,27 @@ import (
func TestQuery1(t *testing.T) {
user := "test"
query := fmt.Sprintf("user:%s", user)
res := ParseQuery(query)
res, err := ParseQuery(query)
if res["user"] != user {
t.Error("Fail TestQuery user parsing")
}
if err != nil {
t.Error(err.Error())
}
}

// TestQuery2
func TestQuery2(t *testing.T) {
user := "test"
attr := "bla foo"
query := fmt.Sprintf("user:%s attr:%s", user, attr)
res := ParseQuery(query)
res, err := ParseQuery(query)
if res["user"] != user {
t.Error("Fail TestQuery user parsing")
}
if err != nil {
t.Error(err.Error())
}
if res["attr"] != attr {
t.Error("Fail TestQuery attr parsing")
}
Expand All @@ -35,10 +41,13 @@ func TestQuery3(t *testing.T) {
attr := "bla foo"
keys := "v1 v2"
query := fmt.Sprintf("user:%s attr:%s keys:%s", user, attr, keys)
res := ParseQuery(query)
res, err := ParseQuery(query)
if res["user"] != user {
t.Error("Fail TestQuery user parsing")
}
if err != nil {
t.Error(err.Error())
}
if res["attr"] != attr {
t.Error("Fail TestQuery attr parsing")
}
Expand Down

0 comments on commit d791db0

Please sign in to comment.