diff --git a/lexical/lexical.go b/lexical/lexical.go index 21426b9..f5c0d65 100644 --- a/lexical/lexical.go +++ b/lexical/lexical.go @@ -142,6 +142,9 @@ func Token() (uint8, *TokenError) { if lexeme == "=" { state = S_SMALLER_OR_EQUAL break + } else if lexeme == ">" { + char = nextChar() + return T_NOT_EQUAL, nil } return T_SMALLER, nil case S_SMALLER_OR_EQUAL: diff --git a/runtime/commits_test.go b/runtime/commits_test.go index dfdfdec..98c7ed8 100644 --- a/runtime/commits_test.go +++ b/runtime/commits_test.go @@ -84,6 +84,16 @@ func TestSelectedFieldsCount(t *testing.T) { } } +func TestNotEqualsInWhereLTGT(t *testing.T) { + queryData := "select committer, hash from commits limit 1" + table := getTableForQuery(queryData, "../", t) + firstCommitter := table.rows[0]["committer"].(string) + query := fmt.Sprintf("select committer, hash from commits where committer <> '%s' limit 1", firstCommitter) + table = getTableForQuery(query, "../", t) + if firstCommitter == table.rows[0]["committer"].(string) { + t.Errorf("Still got the same committer as the first one. - %s", firstCommitter) + } +} func TestNotEqualsInWhere(t *testing.T) { queryData := "select committer, hash from commits limit 1" table := getTableForQuery(queryData, "../", t) @@ -91,6 +101,6 @@ func TestNotEqualsInWhere(t *testing.T) { query := fmt.Sprintf("select committer, hash from commits where committer != '%s' limit 1", firstCommitter) table = getTableForQuery(query, "../", t) if firstCommitter == table.rows[0]["committer"].(string) { - t.Errorf("Strill got the same committer as the first one. - %s", firstCommitter) + t.Errorf("Still got the same committer as the first one. - %s", firstCommitter) } }