good morning!!!!

Skip to content
Snippets Groups Projects
Commit a2eee3ec authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

Adding tests for ordering by function. Will help closing #32.

parent f4b896f7
No related branches found
No related tags found
No related merge requests found
......@@ -419,6 +419,30 @@ func TestSelectFieldsFromWithOrderBy(t *testing.T) {
if s != e {
t.Fatalf("Got: %s, Expecting: %s", s, e)
}
// ORDER BY function
stmt = Statement{
Type: SqlSelect,
Columns: Columns{
{"foo"},
{"bar"},
{"baz"},
},
OrderBy: OrderBy{
SortColumns{
{Column{Raw{"FOO()"}}, SqlSortDesc},
{Column{Raw{"BAR()"}}, SqlSortAsc},
},
},
Table: Table{"table_name"},
}
s = trim(stmt.Compile(defaultTemplate))
e = `SELECT "foo", "bar", "baz" FROM "table_name" ORDER BY FOO() DESC, BAR() ASC`
if s != e {
t.Fatalf("Got: %s, Expecting: %s", s, e)
}
}
func TestSelectFieldsFromWhere(t *testing.T) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment