aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gleam/list.gleam16
-rw-r--r--test/gleam/uri_test.gleam28
2 files changed, 29 insertions, 15 deletions
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam
index 2e8e019..2fff079 100644
--- a/src/gleam/list.gleam
+++ b/src/gleam/list.gleam
@@ -1240,18 +1240,14 @@ fn sequences(
// consecutive equal items) while a descreasing sequence is strictly
// decreasing (no consecutive equal items), this is needed to make the
// algorithm stable!
- order.Gt, Descending
- | order.Lt, Ascending
- | order.Eq, Ascending ->
+ order.Gt, Descending | order.Lt, Ascending | order.Eq, Ascending ->
sequences(rest, compare, growing, direction, new, acc)
// We were growing an ascending (descending) sequence and the new item
// is smaller (bigger) than the previous one, this means we have to stop
// growing this sequence and start with a new one whose first item will
// be the one we just found.
- order.Gt, Ascending
- | order.Lt, Descending
- | order.Eq, Descending -> {
+ order.Gt, Ascending | order.Lt, Descending | order.Eq, Descending -> {
let acc = case direction {
Ascending -> [do_reverse(growing, []), ..acc]
Descending -> [growing, ..acc]
@@ -1374,8 +1370,8 @@ fn merge_ascendings(
[first1, ..rest1], [first2, ..rest2] ->
case compare(first1, first2) {
order.Lt -> merge_ascendings(rest1, list2, compare, [first1, ..acc])
- order.Gt
- | order.Eq -> merge_ascendings(list1, rest2, compare, [first2, ..acc])
+ order.Gt | order.Eq ->
+ merge_ascendings(list1, rest2, compare, [first2, ..acc])
}
}
}
@@ -1400,8 +1396,8 @@ fn merge_descendings(
[first1, ..rest1], [first2, ..rest2] ->
case compare(first1, first2) {
order.Lt -> merge_descendings(list1, rest2, compare, [first2, ..acc])
- order.Gt
- | order.Eq -> merge_descendings(rest1, list2, compare, [first1, ..acc])
+ order.Gt | order.Eq ->
+ merge_descendings(rest1, list2, compare, [first1, ..acc])
}
}
}
diff --git a/test/gleam/uri_test.gleam b/test/gleam/uri_test.gleam
index 506c246..7de6fd5 100644
--- a/test/gleam/uri_test.gleam
+++ b/test/gleam/uri_test.gleam
@@ -341,11 +341,29 @@ pub fn empty_query_to_string_test() {
}
const percent_codec_fixtures = [
- #(" ", "%20"), #(",", "%2C"), #(";", "%3B"), #(":", "%3A"), #("!", "!"),
- #("?", "%3F"), #("'", "'"), #("(", "("), #(")", ")"), #("[", "%5B"),
- #("@", "%40"), #("/", "%2F"), #("\\", "%5C"), #("&", "%26"), #("#", "%23"),
- #("=", "%3D"), #("~", "~"), #("ñ", "%C3%B1"), #("-", "-"), #("_", "_"),
- #(".", "."), #("*", "*"), #("100% great", "100%25%20great"),
+ #(" ", "%20"),
+ #(",", "%2C"),
+ #(";", "%3B"),
+ #(":", "%3A"),
+ #("!", "!"),
+ #("?", "%3F"),
+ #("'", "'"),
+ #("(", "("),
+ #(")", ")"),
+ #("[", "%5B"),
+ #("@", "%40"),
+ #("/", "%2F"),
+ #("\\", "%5C"),
+ #("&", "%26"),
+ #("#", "%23"),
+ #("=", "%3D"),
+ #("~", "~"),
+ #("ñ", "%C3%B1"),
+ #("-", "-"),
+ #("_", "_"),
+ #(".", "."),
+ #("*", "*"),
+ #("100% great", "100%25%20great"),
]
// Allowed chars