Skip to content

Commit

Permalink
Added more test.
Browse files Browse the repository at this point in the history
  • Loading branch information
recipe committed Feb 19, 2024
1 parent f66e778 commit 7dd9ae2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/test_sort_order.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
TRUNCATE `versions`;

INSERT `versions` (`version`, `sort_order`)
SELECT t.column_0 AS `version`, 0 AS `sort_order`
FROM (VALUES
Expand All @@ -21,8 +23,10 @@ FROM (VALUES
) t
ORDER BY RAND();


SELECT `id`, `version`, `sort_order` FROM `versions` ORDER BY `sort_order`;

SELECT IF(GROUP_CONCAT(version) = 'alpha,1.0.0-2021-08-19,1.0-beta,1.0.0-canary.3,1,1.0.1-alpha-3,1.0.1-rc20,1.2,1.3-beta-2,1.3-beta.2,1.3-beta2,1.3,1.4.34,2-alpha,2.0.12-beta.1,11.0.0.1,11.0.0.1.8.22', 'OK!', 'Test failed!') FROM versions ORDER BY sort_order;
SET @expected := 'alpha,1.0.0-2021-08-19,1.0-beta,1.0.0-canary.3,1,1.0.1-alpha-3,1.0.1-rc20,1.2,1.3-beta2,1.3-beta.2,1.3-beta-2,1.3,1.4.34,2-alpha,2.0.12-beta.1,11.0.0.1,11.0.0.1.8.22';

SELECT IF(GROUP_CONCAT(`version` ORDER BY `sort_order`) = @expected, 'OK!', 'Test failed!')
FROM `versions`;

0 comments on commit 7dd9ae2

Please sign in to comment.