aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gleam/atom_test.gleam14
-rw-r--r--test/gleam/bool_test.gleam28
-rw-r--r--test/gleam/dynamic_test.gleam126
-rw-r--r--test/gleam/float_test.gleam92
-rw-r--r--test/gleam/function_test.gleam31
-rw-r--r--test/gleam/int_test.gleam62
-rw-r--r--test/gleam/iodata_test.gleam44
-rw-r--r--test/gleam/list_test.gleam293
-rw-r--r--test/gleam/map_test.gleam227
-rw-r--r--test/gleam/order_test.gleam66
-rw-r--r--test/gleam/pair_test.gleam42
-rw-r--r--test/gleam/result_test.gleam52
-rw-r--r--test/gleam/string_test.gleam90
13 files changed, 539 insertions, 628 deletions
diff --git a/test/gleam/atom_test.gleam b/test/gleam/atom_test.gleam
index da0699a..29a5b41 100644
--- a/test/gleam/atom_test.gleam
+++ b/test/gleam/atom_test.gleam
@@ -12,34 +12,36 @@ pub fn from_string_test() {
"this is not an atom we have seen before"
|> atom.from_string
- |> should.equal(_, Error(atom.AtomNotLoaded))
+ |> should.equal(Error(atom.AtomNotLoaded))
}
pub fn create_from_string_test() {
"ok"
|> atom.create_from_string
|> Ok
- |> should.equal(_, atom.from_string("ok"))
+ |> should.equal(atom.from_string("ok"))
"expect"
|> atom.create_from_string
|> Ok
- |> should.equal(_, atom.from_string("expect"))
+ |> should.equal(atom.from_string("expect"))
"this is another atom we have not seen before"
|> atom.create_from_string
|> Ok
- |> should.equal(_, atom.from_string("this is another atom we have not seen before"))
+ |> should.equal(
+ atom.from_string("this is another atom we have not seen before"),
+ )
}
pub fn to_string_test() {
"ok"
|> atom.create_from_string
|> atom.to_string
- |> should.equal(_, "ok")
+ |> should.equal("ok")
"expect"
|> atom.create_from_string
|> atom.to_string
- |> should.equal(_, "expect")
+ |> should.equal("expect")
}
diff --git a/test/gleam/bool_test.gleam b/test/gleam/bool_test.gleam
index 4e2b8e0..a05327f 100644
--- a/test/gleam/bool_test.gleam
+++ b/test/gleam/bool_test.gleam
@@ -12,50 +12,50 @@ pub fn negate_test() {
pub fn compare_test() {
bool.compare(True, True)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
bool.compare(True, False)
- |> should.equal(_, order.Gt)
+ |> should.equal(order.Gt)
bool.compare(False, False)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
bool.compare(False, True)
- |> should.equal(_, order.Lt)
+ |> should.equal(order.Lt)
}
pub fn max_test() {
bool.max(True, True)
- |> should.equal(_, True)
+ |> should.equal(True)
bool.max(True, False)
- |> should.equal(_, True)
+ |> should.equal(True)
bool.max(False, False)
- |> should.equal(_, False)
+ |> should.equal(False)
bool.max(False, True)
- |> should.equal(_, True)
+ |> should.equal(True)
}
pub fn min_test() {
bool.min(True, True)
- |> should.equal(_, True)
+ |> should.equal(True)
bool.min(True, False)
- |> should.equal(_, False)
+ |> should.equal(False)
bool.min(False, False)
- |> should.equal(_, False)
+ |> should.equal(False)
bool.min(False, True)
- |> should.equal(_, False)
+ |> should.equal(False)
}
pub fn to_int_test() {
bool.to_int(True)
- |> should.equal(_, 1)
+ |> should.equal(1)
bool.to_int(False)
- |> should.equal(_, 0)
+ |> should.equal(0)
}
diff --git a/test/gleam/dynamic_test.gleam b/test/gleam/dynamic_test.gleam
index 2a777c7..4f74556 100644
--- a/test/gleam/dynamic_test.gleam
+++ b/test/gleam/dynamic_test.gleam
@@ -9,66 +9,66 @@ pub fn string_test() {
""
|> dynamic.from
|> dynamic.string
- |> should.equal(_, Ok(""))
+ |> should.equal(Ok(""))
"Hello"
|> dynamic.from
|> dynamic.string
- |> should.equal(_, Ok("Hello"))
+ |> should.equal(Ok("Hello"))
1
|> dynamic.from
|> dynamic.string
- |> should.equal(_, Error("Expected a string, got an int"))
+ |> should.equal(Error("Expected a string, got an int"))
[]
|> dynamic.from
|> dynamic.string
- |> should.equal(_, Error("Expected a string, got a list"))
+ |> should.equal(Error("Expected a string, got a list"))
}
pub fn int_test() {
1
|> dynamic.from
|> dynamic.int
- |> should.equal(_, Ok(1))
+ |> should.equal(Ok(1))
2
|> dynamic.from
|> dynamic.int
- |> should.equal(_, Ok(2))
+ |> should.equal(Ok(2))
1.0
|> dynamic.from
|> dynamic.int
- |> should.equal(_, Error("Expected an int, got a float"))
+ |> should.equal(Error("Expected an int, got a float"))
[]
|> dynamic.from
|> dynamic.int
- |> should.equal(_, Error("Expected an int, got a list"))
+ |> should.equal(Error("Expected an int, got a list"))
}
pub fn float_test() {
1.0
|> dynamic.from
|> dynamic.float
- |> should.equal(_, Ok(1.0))
+ |> should.equal(Ok(1.0))
2.2
|> dynamic.from
|> dynamic.float
- |> should.equal(_, Ok(2.2))
+ |> should.equal(Ok(2.2))
1
|> dynamic.from
|> dynamic.float
- |> should.equal(_, Error("Expected a float, got an int"))
+ |> should.equal(Error("Expected a float, got an int"))
[]
|> dynamic.from
|> dynamic.float
- |> should.equal(_, Error("Expected a float, got a list"))
+ |> should.equal(Error("Expected a float, got a list"))
}
pub fn thunk_test() {
@@ -80,8 +80,8 @@ pub fn thunk_test() {
fn() { 1 }
|> dynamic.from
|> dynamic.thunk
- |> result.map(_, fn(f) { f() })
- |> should.equal(_, Ok(dynamic.from(1)))
+ |> result.map(fn(f) { f() })
+ |> should.equal(Ok(dynamic.from(1)))
fn(x) { x }
|> dynamic.from
@@ -103,87 +103,87 @@ pub fn bool_test() {
True
|> dynamic.from
|> dynamic.bool
- |> should.equal(_, Ok(True))
+ |> should.equal(Ok(True))
False
|> dynamic.from
|> dynamic.bool
- |> should.equal(_, Ok(False))
+ |> should.equal(Ok(False))
1
|> dynamic.from
|> dynamic.bool
- |> should.equal(_, Error("Expected a bool, got an int"))
+ |> should.equal(Error("Expected a bool, got an int"))
[]
|> dynamic.from
|> dynamic.bool
- |> should.equal(_, Error("Expected a bool, got a list"))
+ |> should.equal(Error("Expected a bool, got a list"))
}
pub fn atom_test() {
""
- |> atom.create_from_string
- |> dynamic.from
- |> dynamic.atom
- |> should.equal(_, Ok(atom.create_from_string("")))
+ |> atom.create_from_string
+ |> dynamic.from
+ |> dynamic.atom
+ |> should.equal(Ok(atom.create_from_string("")))
"ok"
- |> atom.create_from_string
- |> dynamic.from
- |> dynamic.atom
- |> should.equal(_, Ok(atom.create_from_string("ok")))
+ |> atom.create_from_string
+ |> dynamic.from
+ |> dynamic.atom
+ |> should.equal(Ok(atom.create_from_string("ok")))
1
- |> dynamic.from
- |> dynamic.atom
- |> should.be_error
+ |> dynamic.from
+ |> dynamic.atom
+ |> should.be_error
[]
- |> dynamic.from
- |> dynamic.atom
- |> should.be_error
+ |> dynamic.from
+ |> dynamic.atom
+ |> should.be_error
}
pub fn list_test() {
[]
|> dynamic.from
- |> dynamic.list(_, dynamic.string)
- |> should.equal(_, Ok([]))
+ |> dynamic.list(dynamic.string)
+ |> should.equal(Ok([]))
[]
|> dynamic.from
- |> dynamic.list(_, dynamic.int)
- |> should.equal(_, Ok([]))
+ |> dynamic.list(dynamic.int)
+ |> should.equal(Ok([]))
[1, 2, 3]
|> dynamic.from
- |> dynamic.list(_, dynamic.int)
- |> should.equal(_, Ok([1, 2, 3]))
+ |> dynamic.list(dynamic.int)
+ |> should.equal(Ok([1, 2, 3]))
[[1], [2], [3]]
|> dynamic.from
- |> dynamic.list(_, dynamic.list(_, dynamic.int))
- |> should.equal(_, Ok([[1], [2], [3]]))
+ |> dynamic.list(dynamic.list(_, dynamic.int))
+ |> should.equal(Ok([[1], [2], [3]]))
1
|> dynamic.from
- |> dynamic.list(_, dynamic.string)
+ |> dynamic.list(dynamic.string)
|> should.be_error
1.0
|> dynamic.from
- |> dynamic.list(_, dynamic.int)
+ |> dynamic.list(dynamic.int)
|> should.be_error
[""]
|> dynamic.from
- |> dynamic.list(_, dynamic.int)
+ |> dynamic.list(dynamic.int)
|> should.be_error
[dynamic.from(1), dynamic.from("not an int")]
|> dynamic.from
- |> dynamic.list(_, dynamic.int)
+ |> dynamic.list(dynamic.int)
|> should.be_error
}
@@ -192,31 +192,31 @@ pub fn field_test() {
let Ok(error_atom) = atom.from_string("error")
map.new()
- |> map.insert(_, ok_atom, 1)
+ |> map.insert(ok_atom, 1)
|> dynamic.from
- |> dynamic.field(_, ok_atom)
- |> should.equal(_, Ok(dynamic.from(1)))
+ |> dynamic.field(ok_atom)
+ |> should.equal(Ok(dynamic.from(1)))
map.new()
- |> map.insert(_, ok_atom, 3)
- |> map.insert(_, error_atom, 1)
+ |> map.insert(ok_atom, 3)
+ |> map.insert(error_atom, 1)
|> dynamic.from
- |> dynamic.field(_, ok_atom)
- |> should.equal(_, Ok(dynamic.from(3)))
+ |> dynamic.field(ok_atom)
+ |> should.equal(Ok(dynamic.from(3)))
map.new()
|> dynamic.from
- |> dynamic.field(_, ok_atom)
+ |> dynamic.field(ok_atom)
|> should.be_error
1
|> dynamic.from
- |> dynamic.field(_, ok_atom)
+ |> dynamic.field(ok_atom)
|> should.be_error
[]
|> dynamic.from
- |> dynamic.field(_, [])
+ |> dynamic.field([])
|> should.be_error
}
@@ -226,32 +226,32 @@ pub fn element_test() {
ok_one_tuple
|> dynamic.from
- |> dynamic.element(_, 0)
- |> should.equal(_, Ok(dynamic.from(ok_atom)))
+ |> dynamic.element(0)
+ |> should.equal(Ok(dynamic.from(ok_atom)))
ok_one_tuple
|> dynamic.from
- |> dynamic.element(_, 1)
- |> should.equal(_, Ok(dynamic.from(1)))
+ |> dynamic.element(1)
+ |> should.equal(Ok(dynamic.from(1)))
ok_one_tuple
|> dynamic.from
- |> dynamic.element(_, 2)
+ |> dynamic.element(2)
|> should.be_error
ok_one_tuple
|> dynamic.from
- |> dynamic.element(_, -1)
+ |> dynamic.element(-1)
|> should.be_error
1
|> dynamic.from
- |> dynamic.element(_, 0)
+ |> dynamic.element(0)
|> should.be_error
map.new()
- |> map.insert(_, 1, ok_atom)
+ |> map.insert(1, ok_atom)
|> dynamic.from
- |> dynamic.element(_, 0)
+ |> dynamic.element(0)
|> should.be_error
}
diff --git a/test/gleam/float_test.gleam b/test/gleam/float_test.gleam
index 038801a..d8ed02e 100644
--- a/test/gleam/float_test.gleam
+++ b/test/gleam/float_test.gleam
@@ -5,181 +5,181 @@ import gleam/order
pub fn parse_test() {
"1.23"
|> float.parse
- |> should.equal(_, Ok(1.23))
+ |> should.equal(Ok(1.23))
"5.0"
|> float.parse
- |> should.equal(_, Ok(5.0))
+ |> should.equal(Ok(5.0))
"0.123456789"
|> float.parse
- |> should.equal(_, Ok(0.123456789))
+ |> should.equal(Ok(0.123456789))
""
|> float.parse
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
"what"
|> float.parse
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
"1"
|> float.parse
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
}
pub fn to_string_test() {
123.0
|> float.to_string
- |> should.equal(_, "123.0")
+ |> should.equal("123.0")
-8.1
|> float.to_string
- |> should.equal(_, "-8.1")
+ |> should.equal("-8.1")
}
pub fn compare_test() {
float.compare(0., 0.)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
float.compare(0.1, 0.1)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
float.compare(0., 0.1)
- |> should.equal(_, order.Lt)
+ |> should.equal(order.Lt)
float.compare(-2., -1.9)
- |> should.equal(_, order.Lt)
+ |> should.equal(order.Lt)
float.compare(2., 1.9)
- |> should.equal(_, order.Gt)
+ |> should.equal(order.Gt)
float.compare(-1.9, -2.)
- |> should.equal(_, order.Gt)
+ |> should.equal(order.Gt)
}
pub fn ceiling_test() {
8.1
|> float.ceiling
- |> should.equal(_, 9.0)
+ |> should.equal(9.0)
-8.1
|> float.ceiling
- |> should.equal(_, -8.0)
+ |> should.equal(-8.0)
-8.0
|> float.ceiling
- |> should.equal(_, -8.0)
+ |> should.equal(-8.0)
}
pub fn floor_test() {
8.1
|> float.floor
- |> should.equal(_, 8.0)
+ |> should.equal(8.0)
-8.1
|> float.floor
- |> should.equal(_, -9.0)
+ |> should.equal(-9.0)
-8.0
|> float.floor
- |> should.equal(_, -8.0)
+ |> should.equal(-8.0)
}
pub fn round_test() {
8.1
|> float.round
- |> should.equal(_, 8)
+ |> should.equal(8)
8.4
|> float.round
- |> should.equal(_, 8)
+ |> should.equal(8)
8.499
|> float.round
- |> should.equal(_, 8)
+ |> should.equal(8)
8.5
|> float.round
- |> should.equal(_, 9)
+ |> should.equal(9)
-8.1
|> float.round
- |> should.equal(_, -8)
+ |> should.equal(-8)
-7.5
|> float.round
- |> should.equal(_, -8)
+ |> should.equal(-8)
}
pub fn truncate_test() {
8.1
|> float.truncate
- |> should.equal(_, 8)
+ |> should.equal(8)
8.4
|> float.truncate
- |> should.equal(_, 8)
+ |> should.equal(8)
8.499
|> float.truncate
- |> should.equal(_, 8)
+ |> should.equal(8)
8.5
|> float.truncate
- |> should.equal(_, 8)
+ |> should.equal(8)
-8.1
|> float.truncate
- |> should.equal(_, -8)
+ |> should.equal(-8)
-7.5
|> float.truncate
- |> should.equal(_, -7)
+ |> should.equal(-7)
}
pub fn min_test() {
float.min(0., 0.)
- |> should.equal(_, 0.)
+ |> should.equal(0.)
float.min(0.3, 1.5)
- |> should.equal(_, 0.3)
+ |> should.equal(0.3)
float.min(1., 0.)
- |> should.equal(_, 0.)
+ |> should.equal(0.)
float.min(-1.7, 2.5)
- |> should.equal(_, -1.7)
+ |> should.equal(-1.7)
float.min(-2.2, -2.2)
- |> should.equal(_, -2.2)
+ |> should.equal(-2.2)
float.min(-1., -1.)
- |> should.equal(_, -1.)
+ |> should.equal(-1.)
float.min(-1.1, -1.)
- |> should.equal(_, -1.1)
+ |> should.equal(-1.1)
}
pub fn max_test() {
float.max(0., 0.)
- |> should.equal(_, 0.)
+ |> should.equal(0.)
float.max(0.3, 1.5)
- |> should.equal(_, 1.5)
+ |> should.equal(1.5)
float.max(1., 0.)
- |> should.equal(_, 1.)
+ |> should.equal(1.)
float.max(-1.7, 2.5)
- |> should.equal(_, 2.5)
+ |> should.equal(2.5)
float.max(-2.2, -2.2)
- |> should.equal(_, -2.2)
+ |> should.equal(-2.2)
float.max(-1., -1.)
- |> should.equal(_, -1.)
+ |> should.equal(-1.)
float.max(-1.1, -1.)
- |> should.equal(_, -1.)
+ |> should.equal(-1.)
}
diff --git a/test/gleam/function_test.gleam b/test/gleam/function_test.gleam
index ee4fc00..eb94581 100644
--- a/test/gleam/function_test.gleam
+++ b/test/gleam/function_test.gleam
@@ -13,56 +13,55 @@ pub fn compose_test() {
1
|> add_five
- |> should.equal(_, 6)
+ |> should.equal(6)
// Takes a list of ints and returns the head as a string (if there is one, or
// else "0" if there is not)
- let head_to_string =
- list.head
- |> function.compose(_, result.unwrap(_, 0))
- |> function.compose(_, int.to_string)
+ let head_to_string = list.head
+ |> function.compose(result.unwrap(_, 0))
+ |> function.compose(int.to_string)
[1]
|> head_to_string
- |> should.equal(_, "1")
+ |> should.equal("1")
[]
|> head_to_string
- |> should.equal(_, "0")
+ |> should.equal("0")
}
pub fn flip_test() {
let fun = fn(s: String, i: Int) {
s
|> string.append("String: '", _)
- |> string.append(_, "', Int: '")
- |> string.append(_, int.to_string(i))
- |> string.append(_, "'")
+ |> string.append("', Int: '")
+ |> string.append(int.to_string(i))
+ |> string.append("'")
}
let flipped_fun = function.flip(fun)
fun("Bob", 1)
- |> should.equal(_, "String: 'Bob', Int: '1'")
+ |> should.equal("String: 'Bob', Int: '1'")
flipped_fun(2, "Alice")
- |> should.equal(_, "String: 'Alice', Int: '2'")
+ |> should.equal("String: 'Alice', Int: '2'")
}
pub fn identity_test() {
1
|> function.identity
- |> should.equal(_, 1)
+ |> should.equal(1)
""
|> function.identity
- |> should.equal(_, "")
+ |> should.equal("")
[]
|> function.identity
- |> should.equal(_, [])
+ |> should.equal([])
tuple(1, 2.0)
|> function.identity
- |> should.equal(_, tuple(1, 2.0))
+ |> should.equal(tuple(1, 2.0))
}
diff --git a/test/gleam/int_test.gleam b/test/gleam/int_test.gleam
index 27335d5..204e72c 100644
--- a/test/gleam/int_test.gleam
+++ b/test/gleam/int_test.gleam
@@ -5,111 +5,111 @@ import gleam/order
pub fn to_string() {
123
|> int.to_string
- |> should.equal(_, "123")
+ |> should.equal("123")
-123
|> int.to_string
- |> should.equal(_, "-123")
+ |> should.equal("-123")
123
|> int.to_string
- |> should.equal(_, "123")
+ |> should.equal("123")
}
pub fn parse() {
"123"
|> int.parse
- |> should.equal(_, Ok(123))
+ |> should.equal(Ok(123))
"-123"
|> int.parse
- |> should.equal(_, Ok(-123))
+ |> should.equal(Ok(-123))
"0123"
|> int.parse
- |> should.equal(_, Ok(123))
+ |> should.equal(Ok(123))
""
|> int.parse
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
"what"
|> int.parse
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
"1.23"
|> int.parse
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
}
pub fn to_base_string() {
100
- |> int.to_base_string(_, 16)
- |> should.equal(_, "64")
+ |> int.to_base_string(16)
+ |> should.equal("64")
-100
- |> int.to_base_string(_, 16)
- |> should.equal(_, "-64")
+ |> int.to_base_string(16)
+ |> should.equal("-64")
}
pub fn compare_test() {
int.compare(0, 0)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
int.compare(1, 1)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
int.compare(0, 1)
- |> should.equal(_, order.Lt)
+ |> should.equal(order.Lt)
int.compare(-2, -1)
- |> should.equal(_, order.Lt)
+ |> should.equal(order.Lt)
int.compare(2, 1)
- |> should.equal(_, order.Gt)
+ |> should.equal(order.Gt)
int.compare(-1, -2)
- |> should.equal(_, order.Gt)
+ |> should.equal(order.Gt)
}
pub fn min_test() {
int.min(0, 0)
- |> should.equal(_, 0)
+ |> should.equal(0)
int.min(0, 1)
- |> should.equal(_, 0)
+ |> should.equal(0)
int.min(1, 0)
- |> should.equal(_, 0)
+ |> should.equal(0)
int.min(-1, 2)
- |> should.equal(_, -1)
+ |> should.equal(-1)
int.min(2, -2)
- |> should.equal(_, -2)
+ |> should.equal(-2)
int.min(-1, -1)
- |> should.equal(_, -1)
+ |> should.equal(-1)
}
pub fn max_test() {
int.max(0, 0)
- |> should.equal(_, 0)
+ |> should.equal(0)
int.max(0, 1)
- |> should.equal(_, 1)
+ |> should.equal(1)
int.max(1, 0)
- |> should.equal(_, 1)
+ |> should.equal(1)
int.max(-1, 2)
- |> should.equal(_, 2)
+ |> should.equal(2)
int.max(2, -2)
- |> should.equal(_, 2)
+ |> should.equal(2)
int.max(-1, -1)
- |> should.equal(_, -1)
+ |> should.equal(-1)
}
pub fn is_even_test() {
diff --git a/test/gleam/iodata_test.gleam b/test/gleam/iodata_test.gleam
index e9922e4..bc4fe98 100644
--- a/test/gleam/iodata_test.gleam
+++ b/test/gleam/iodata_test.gleam
@@ -3,30 +3,32 @@ import gleam/iodata
pub fn iodata_test() {
let data = iodata.new("ello")
- |> iodata.append(_, ",")
- |> iodata.append(_, " world!")
- |> iodata.prepend(_, "H")
+ |> iodata.append(",")
+ |> iodata.append(" world!")
+ |> iodata.prepend("H")
data
|> iodata.to_string
- |> should.equal(_, "Hello, world!")
+ |> should.equal("Hello, world!")
data
|> iodata.byte_size
- |> should.equal(_, 13)
+ |> should.equal(13)
let data = iodata.new("ello")
- |> iodata.append_iodata(_, iodata.new(","))
- |> iodata.append_iodata(_, iodata.concat([iodata.new(" wo"), iodata.new("rld!")]))
- |> iodata.prepend_iodata(_, iodata.new("H"))
+ |> iodata.append_iodata(iodata.new(","))
+ |> iodata.append_iodata(
+ iodata.concat([iodata.new(" wo"), iodata.new("rld!")]),
+ )
+ |> iodata.prepend_iodata(iodata.new("H"))
data
|> iodata.to_string
- |> should.equal(_, "Hello, world!")
+ |> should.equal("Hello, world!")
data
|> iodata.byte_size
- |> should.equal(_, 13)
+ |> should.equal(13)
}
pub fn lowercase_test() {
@@ -34,7 +36,7 @@ pub fn lowercase_test() {
|> iodata.from_strings
|> iodata.lowercase
|> iodata.to_string
- |> should.equal(_, "gleamgleam")
+ |> should.equal("gleamgleam")
}
pub fn uppercase_test() {
@@ -42,32 +44,36 @@ pub fn uppercase_test() {
|> iodata.from_strings
|> iodata.uppercase
|> iodata.to_string
- |> should.equal(_, "GLEAMGLEAM")
+ |> should.equal("GLEAMGLEAM")
}
pub fn split_test() {
"Gleam,Erlang,Elixir"
|> iodata.new
- |> iodata.split(_, ",")
- |> should.equal(_, [iodata.new("Gleam"), iodata.new("Erlang"), iodata.new("Elixir")])
+ |> iodata.split(",")
+ |> should.equal(
+ [iodata.new("Gleam"), iodata.new("Erlang"), iodata.new("Elixir")],
+ )
["Gleam, Erl", "ang,Elixir"]
|> iodata.from_strings
- |> iodata.split(_, ", ")
- |> should.equal(_, [iodata.new("Gleam"), iodata.from_strings(["Erl", "ang,Elixir"])])
+ |> iodata.split(", ")
+ |> should.equal(
+ [iodata.new("Gleam"), iodata.from_strings(["Erl", "ang,Elixir"])],
+ )
}
pub fn is_equal_test() {
iodata.new("12")
- |> iodata.is_equal(_, iodata.from_strings(["1", "2"]))
+ |> iodata.is_equal(iodata.from_strings(["1", "2"]))
|> should.be_true
iodata.new("12")
- |> iodata.is_equal(_, iodata.new("12"))
+ |> iodata.is_equal(iodata.new("12"))
|> should.be_true
iodata.new("12")
- |> iodata.is_equal(_, iodata.new("2"))
+ |> iodata.is_equal(iodata.new("2"))
|> should.be_false
}
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index d54fe8f..1be4e43 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -7,79 +7,86 @@ import gleam/pair
pub fn length_test() {
list.length([])
- |> should.equal(_, 0)
+ |> should.equal(0)
list.length([1])
- |> should.equal(_, 1)
+ |> should.equal(1)
list.length([1, 1])
- |> should.equal(_, 2)
+ |> should.equal(2)
list.length([1, 1, 1])
- |> should.equal(_, 3)
+ |> should.equal(3)
}
pub fn reverse_test() {
- list.reverse([]) |> should.equal(_, [])
- list.reverse([1, 2, 3, 4, 5]) |> should.equal(_, [5, 4, 3, 2, 1])
+ list.reverse([])
+ |> should.equal([])
+ list.reverse([1, 2, 3, 4, 5])
+ |> should.equal([5, 4, 3, 2, 1])
}
pub fn is_empty_test() {
- list.is_empty([]) |> should.be_true
- list.is_empty([1]) |> should.be_false
+ list.is_empty([])
+ |> should.be_true
+ list.is_empty([1])
+ |> should.be_false
}
pub fn contains_test() {
- list.contains([0, 4, 5, 1], 1) |> should.be_true
- list.contains([0, 4, 5, 7], 1) |> should.be_false
- list.contains([], 1) |> should.be_false
+ list.contains([0, 4, 5, 1], 1)
+ |> should.be_true
+ list.contains([0, 4, 5, 7], 1)
+ |> should.be_false
+ list.contains([], 1)
+ |> should.be_false
}
pub fn head_test() {
list.head([0, 4, 5, 7])
- |> should.equal(_, Ok(0))
+ |> should.equal(Ok(0))
list.head([])
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
}
pub fn tail_test() {
list.tail([0, 4, 5, 7])
- |> should.equal(_, Ok([4, 5, 7]))
+ |> should.equal(Ok([4, 5, 7]))
list.tail([0])
- |> should.equal(_, Ok([]))
+ |> should.equal(Ok([]))
list.tail([])
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
}
pub fn filter_test() {
[]
- |> list.filter(_, fn(_) { True })
- |> should.equal(_, [])
+ |> list.filter(fn(_) { True })
+ |> should.equal([])
[0, 4, 5, 7, 3]
- |> list.filter(_, fn(_) { True })
- |> should.equal(_, [0, 4, 5, 7, 3])
+ |> list.filter(fn(_) { True })
+ |> should.equal([0, 4, 5, 7, 3])
[0, 4, 5, 7, 3]
- |> list.filter(_, fn(x) { x > 4 })
- |> should.equal(_, [5, 7])
+ |> list.filter(fn(x) { x > 4 })
+ |> should.equal([5, 7])
[0, 4, 5, 7, 3]
- |> list.filter(_, fn(x) { x < 4 })
- |> should.equal(_, [0, 3])
+ |> list.filter(fn(x) { x < 4 })
+ |> should.equal([0, 3])
}
pub fn map_test() {
[]
- |> list.map(_, fn(x) { x * 2 })
- |> should.equal(_, [])
+ |> list.map(fn(x) { x * 2 })
+ |> should.equal([])
[0, 4, 5, 7, 3]
- |> list.map(_, fn(x) { x * 2 })
- |> should.equal(_, [0, 8, 10, 14, 6])
+ |> list.map(fn(x) { x * 2 })
+ |> should.equal([0, 8, 10, 14, 6])
}
pub fn traverse_test() {
@@ -91,66 +98,67 @@ pub fn traverse_test() {
}
[5, 6, 5, 6]
- |> list.traverse(_, fun)
- |> should.equal(_, Ok([10, 12, 10, 12]))
+ |> list.traverse(fun)
+ |> should.equal(Ok([10, 12, 10, 12]))
[4, 6, 5, 7, 3]
- |> list.traverse(_, fun)
- |> should.equal(_, Error(7))
+ |> list.traverse(fun)
+ |> should.equal(Error(7))
}
pub fn drop_test() {
[]
- |> list.drop(_, 5)
- |> should.equal(_, [])
+ |> list.drop(5)
+ |> should.equal([])
[1, 2, 3, 4, 5, 6, 7, 8]
- |> list.drop(_, 5)
- |> should.equal(_, [6, 7, 8])
+ |> list.drop(5)
+ |> should.equal([6, 7, 8])
}
pub fn take_test() {
[]
- |> list.take(_, 5)
- |> should.equal(_, [])
+ |> list.take(5)
+ |> should.equal([])
[1, 2, 3, 4, 5, 6, 7, 8]
- |> list.take(_, 5)
- |> should.equal(_, [1, 2, 3, 4, 5])
+ |> list.take(5)
+ |> should.equal([1, 2, 3, 4, 5])
}
pub fn new_test() {
- list.new() |> should.equal(_, [])
+ list.new()
+ |> should.equal([])
}
pub fn append_test() {
list.append([1], [2, 3])
- |> should.equal(_, [1, 2, 3])
+ |> should.equal([1, 2, 3])
}
pub fn flatten_test() {
list.flatten([])
- |> should.equal(_, [])
+ |> should.equal([])
list.flatten([[]])
- |> should.equal(_, [])
+ |> should.equal([])
list.flatten([[], [], []])
- |> should.equal(_, [])
+ |> should.equal([])
list.flatten([[1, 2], [], [3, 4]])
- |> should.equal(_, [1, 2, 3, 4])
+ |> should.equal([1, 2, 3, 4])
}
pub fn fold_test() {
[1, 2, 3]
- |> list.fold(_, [], fn(x, acc) { [x | acc] })
- |> should.equal(_, [3, 2, 1])
+ |> list.fold([], fn(x, acc) { [x, ..acc] })
+ |> should.equal([3, 2, 1])
}
pub fn fold_right_test() {
[1, 2, 3]
- |> list.fold_right(_, from: [], with: fn(x, acc) { [x | acc] })
- |> should.equal(_, [1, 2, 3])
+ |> list.fold_right(from: [], with: fn(x, acc) { [x, ..acc] })
+ |> should.equal([1, 2, 3])
}
pub fn find_map_test() {
@@ -162,256 +170,247 @@ pub fn find_map_test() {
}
[1, 2, 3]
- |> list.find_map(_, with: f)
- |> should.equal(_, Ok(4))
+ |> list.find_map(with: f)
+ |> should.equal(Ok(4))
[1, 3, 2]
- |> list.find_map(_, with: f)
- |> should.equal(_, Ok(4))
+ |> list.find_map(with: f)
+ |> should.equal(Ok(4))
[1, 3]
- |> list.find_map(_, with: f)
- |> should.equal(_, Error(Nil))
+ |> list.find_map(with: f)
+ |> should.equal(Error(Nil))
}
pub fn find_test() {
- let is_two = fn(x) {
- x == 2
- }
+ let is_two = fn(x) { x == 2 }
[1, 2, 3]
- |> list.find(_, one_that: is_two)
- |> should.equal(_, Ok(2))
+ |> list.find(one_that: is_two)
+ |> should.equal(Ok(2))
[1, 3, 2]
- |> list.find(_, one_that: is_two)
- |> should.equal(_, Ok(2))
+ |> list.find(one_that: is_two)
+ |> should.equal(Ok(2))
[1, 3]
- |> list.find(_, one_that: is_two)
- |> should.equal(_, Error(Nil))
+ |> list.find(one_that: is_two)
+ |> should.equal(Error(Nil))
}
pub fn all_test() {
list.all([1, 2, 3, 4, 5], fn(x) { x > 0 })
- |> should.equal(_, True)
+ |> should.equal(True)
list.all([1, 2, 3, 4, 5], fn(x) { x < 0 })
- |> should.equal(_, False)
+ |> should.equal(False)
list.all([], fn(_) { False })
- |> should.equal(_, True)
+ |> should.equal(True)
}
pub fn any_test() {
list.any([1, 2, 3, 4, 5], fn(x) { x == 2 })
- |> should.equal(_, True)
+ |> should.equal(True)
list.any([1, 2, 3, 4, 5], fn(x) { x < 0 })
- |> should.equal(_, False)
+ |> should.equal(False)
list.any([], fn(_) { False })
- |> should.equal(_, False)
+ |> should.equal(False)
}
pub fn zip_test() {
list.zip([], [1, 2, 3])
- |> should.equal(_, [])
+ |> should.equal([])
list.zip([1, 2], [])
- |> should.equal(_, [])
+ |> should.equal([])
list.zip([1, 2, 3], [4, 5, 6])
- |> should.equal(_, [tuple(1, 4), tuple(2, 5), tuple(3, 6)])
+ |> should.equal([tuple(1, 4), tuple(2, 5), tuple(3, 6)])
list.zip([5, 6], [1, 2, 3])
- |> should.equal(_, [tuple(5, 1), tuple(6, 2)])
+ |> should.equal([tuple(5, 1), tuple(6, 2)])
list.zip([5, 6, 7], [1, 2])
- |> should.equal(_, [tuple(5, 1), tuple(6, 2)])
+ |> should.equal([tuple(5, 1), tuple(6, 2)])
}
pub fn strict_zip_test() {
list.strict_zip([], [1, 2, 3])
- |> should.equal(_, Error(list.LengthMismatch))
+ |> should.equal(Error(list.LengthMismatch))
list.strict_zip([1, 2], [])
- |> should.equal(_, Error(list.LengthMismatch))
+ |> should.equal(Error(list.LengthMismatch))
list.strict_zip([1, 2, 3], [4, 5, 6])
- |> should.equal(_, Ok([
- tuple(1, 4),
- tuple(2, 5),
- tuple(3, 6),
- ]))
+ |> should.equal(Ok([tuple(1, 4), tuple(2, 5), tuple(3, 6)]))
list.strict_zip([5, 6], [1, 2, 3])
- |> should.equal(_, Error(list.LengthMismatch))
+ |> should.equal(Error(list.LengthMismatch))
list.strict_zip([5, 6, 7], [1, 2])
- |> should.equal(_, Error(list.LengthMismatch))
+ |> should.equal(Error(list.LengthMismatch))
}
pub fn intersperse_test() {
list.intersperse([1, 2, 3], 4)
- |> should.equal(_, [1, 4, 2, 4, 3])
+ |> should.equal([1, 4, 2, 4, 3])
list.intersperse([], 2)
- |> should.equal(_, [])
+ |> should.equal([])
}
pub fn at_test() {
list.at([1, 2, 3], 2)
- |> should.equal(_, Ok(3))
+ |> should.equal(Ok(3))
list.at([1, 2, 3], 5)
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
list.at([], 0)
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
list.at([1, 2, 3, 4, 5, 6], -1)
- |> should.equal(_, Error(Nil))
+ |> should.equal(Error(Nil))
}
pub fn unique_test() {
list.unique([1, 1, 2, 3, 4, 4, 4, 5, 6])
- |> should.equal(_, [1, 2, 3, 4, 5, 6])
+ |> should.equal([1, 2, 3, 4, 5, 6])
list.unique([7, 1, 45, 6, 2, 47, 2, 7, 5])
- |> should.equal(_, [7, 1, 45, 6, 2, 47, 5])
+ |> should.equal([7, 1, 45, 6, 2, 47, 5])
list.unique([3, 4, 5])
- |> should.equal(_, [3, 4, 5])
+ |> should.equal([3, 4, 5])
list.unique([])
- |> should.equal(_, [])
+ |> should.equal([])
}
pub fn sort_test() {
[4, 3, 6, 5, 4]
- |> list.sort(_, int.compare)
- |> should.equal(_, [3, 4, 4, 5, 6])
+ |> list.sort(int.compare)
+ |> should.equal([3, 4, 4, 5, 6])
[4, 3, 6, 5, 4, 1]
- |> list.sort(_, int.compare)
- |> should.equal(_, [1, 3, 4, 4, 5, 6])
+ |> list.sort(int.compare)
+ |> should.equal([1, 3, 4, 4, 5, 6])
[4.1, 3.1, 6.1, 5.1, 4.1]
- |> list.sort(_, float.compare)
- |> should.equal(_, [3.1, 4.1, 4.1, 5.1, 6.1])
+ |> list.sort(float.compare)
+ |> should.equal([3.1, 4.1, 4.1, 5.1, 6.1])
[]
- |> list.sort(_, int.compare)
- |> should.equal(_, [])
+ |> list.sort(int.compare)
+ |> should.equal([])
}
pub fn index_map_test() {
list.index_map([3, 4, 5], fn(i, x) { tuple(i, x) })
- |> should.equal(_, [tuple(0, 3), tuple(1, 4), tuple(2, 5)])
+ |> should.equal([tuple(0, 3), tuple(1, 4), tuple(2, 5)])
- let f = fn(i, x) {
- string.append(x, int.to_string(i))
- }
+ let f = fn(i, x) { string.append(x, int.to_string(i)) }
list.index_map(["a", "b", "c"], f)
- |> should.equal(_, ["a0", "b1", "c2"])
+ |> should.equal(["a0", "b1", "c2"])
}
pub fn range_test() {
list.range(0, 0)
- |> should.equal(_, [])
+ |> should.equal([])
list.range(1, 1)
- |> should.equal(_, [])
+ |> should.equal([])
list.range(-1, -1)
- |> should.equal(_, [])
+ |> should.equal([])
list.range(0, 1)
- |> should.equal(_, [0])
+ |> should.equal([0])
list.range(0, 5)
- |> should.equal(_, [0, 1, 2, 3, 4])
+ |> should.equal([0, 1, 2, 3, 4])
list.range(1, -5)
- |> should.equal(_, [1, 0, -1, -2, -3, -4])
+ |> should.equal([1, 0, -1, -2, -3, -4])
}
pub fn repeat_test() {
list.repeat(1, -10)
- |> should.equal(_, [])
+ |> should.equal([])
list.repeat(1, 0)
- |> should.equal(_, [])
+ |> should.equal([])
list.repeat(2, 3)
- |> should.equal(_, [2, 2, 2])
+ |> should.equal([2, 2, 2])
list.repeat("x", 5)
- |> should.equal(_, ["x", "x", "x", "x", "x"])
+ |> should.equal(["x", "x", "x", "x", "x"])
}
pub fn split_test() {
[]
- |> list.split(_, 0)
- |> should.equal(_, tuple([], []))
+ |> list.split(0)
+ |> should.equal(tuple([], []))
[0, 1, 2, 3, 4]
- |> list.split(_, 0)
- |> should.equal(_, tuple([], [0, 1, 2, 3, 4]))
+ |> list.split(0)
+ |> should.equal(tuple([], [0, 1, 2, 3, 4]))
[0, 1, 2, 3, 4]
- |> list.split(_, -2)
- |> should.equal(_, tuple([], [0, 1, 2, 3, 4]))
+ |> list.split(-2)
+ |> should.equal(tuple([], [0, 1, 2, 3, 4]))
[0, 1, 2, 3, 4]
- |> list.split(_, 1)
- |> should.equal(_, tuple([0], [1, 2, 3, 4]))
+ |> list.split(1)
+ |> should.equal(tuple([0], [1, 2, 3, 4]))
[0, 1, 2, 3, 4]
- |> list.split(_, 3)
- |> should.equal(_, tuple([0, 1, 2], [3, 4]))
+ |> list.split(3)
+ |> should.equal(tuple([0, 1, 2], [3, 4]))
[0, 1, 2, 3, 4]
- |> list.split(_, 9)
- |> should.equal(_, tuple([0, 1, 2, 3, 4], []))
+ |> list.split(9)
+ |> should.equal(tuple([0, 1, 2, 3, 4], []))
}
pub fn split_while_test() {
[]
- |> list.split_while(_, fn(x) { x <= 5 })
- |> should.equal(_, tuple([], []))
+ |> list.split_while(fn(x) { x <= 5 })
+ |> should.equal(tuple([], []))
[1, 2, 3, 4, 5]
- |> list.split_while(_, fn(x) { x <= 5 })
- |> should.equal(_, tuple([1, 2, 3, 4, 5], []))
+ |> list.split_while(fn(x) { x <= 5 })
+ |> should.equal(tuple([1, 2, 3, 4, 5], []))
[1, 2, 3, 4, 5]
- |> list.split_while(_, fn(x) { x == 2 })
- |> should.equal(_, tuple([], [1, 2, 3, 4, 5]))
+ |> list.split_while(fn(x) { x == 2 })
+ |> should.equal(tuple([], [1, 2, 3, 4, 5]))
[1, 2, 3, 4, 5]
- |> list.split_while(_, fn(x) { x <= 3 })
- |> should.equal(_, tuple([1, 2, 3], [4, 5]))
+ |> list.split_while(fn(x) { x <= 3 })
+ |> should.equal(tuple([1, 2, 3], [4, 5]))
[1, 2, 3, 4, 5]
- |> list.split_while(_, fn(x) { x <= -3 })
- |> should.equal(_, tuple([], [1, 2, 3, 4, 5]))
+ |> list.split_while(fn(x) { x <= -3 })
+ |> should.equal(tuple([], [1, 2, 3, 4, 5]))
}
-
pub fn key_find_test() {
let proplist = [tuple(0, "1"), tuple(1, "2")]
proplist
- |> list.key_find(_, 0)
- |> should.equal(_, Ok("1"))
+ |> list.key_find(0)
+ |> should.equal(Ok("1"))
proplist
- |> list.key_find(_, 1)
- |> should.equal(_, Ok("2"))
+ |> list.key_find(1)
+ |> should.equal(Ok("2"))
proplist
- |> list.key_find(_, 2)
- |> should.equal(_, Error(Nil))
+ |> list.key_find(2)
+ |> should.equal(Error(Nil))
}
diff --git a/test/gleam/map_test.gleam b/test/gleam/map_test.gleam
index 58b7cb5..abd3daf 100644
--- a/test/gleam/map_test.gleam
+++ b/test/gleam/map_test.gleam
@@ -3,201 +3,134 @@ import gleam/should
import gleam/map
pub fn from_list_test() {
- [
- tuple(4, 0),
- tuple(1, 0),
- ]
+ [tuple(4, 0), tuple(1, 0)]
|> map.from_list
|> map.size
- |> should.equal(_, 2)
+ |> should.equal(2)
- [
- tuple(1, 0),
- tuple(1, 1),
- ]
+ [tuple(1, 0), tuple(1, 1)]
|> map.from_list
- |> should.equal(_, map.from_list([tuple(1, 1)]))
+ |> should.equal(map.from_list([tuple(1, 1)]))
}
pub fn has_key_test() {
[]
|> map.from_list
- |> map.has_key(_, 1)
+ |> map.has_key(1)
|> should.be_false
- [
- tuple(1, 0),
- ]
+ [tuple(1, 0)]
|> map.from_list
- |> map.has_key(_, 1)
+ |> map.has_key(1)
|> should.be_true
- [
- tuple(4, 0),
- tuple(1, 0),
- ]
+ [tuple(4, 0), tuple(1, 0)]
|> map.from_list
- |> map.has_key(_, 1)
+ |> map.has_key(1)
|> should.be_true
- [
- tuple(4, 0),
- tuple(1, 0),
- ]
+ [tuple(4, 0), tuple(1, 0)]
|> map.from_list
- |> map.has_key(_, 0)
+ |> map.has_key(0)
|> should.be_false
}
pub fn new_test() {
map.new()
|> map.size
- |> should.equal(_, 0)
+ |> should.equal(0)
map.new()
|> map.to_list
- |> should.equal(_, [])
+ |> should.equal([])
}
pub fn get_test() {
- let proplist = [
- tuple(4, 0),
- tuple(1, 1),
- ]
+ let proplist = [tuple(4, 0), tuple(1, 1)]
let m = map.from_list(proplist)
m
- |> map.get(_, 4)
- |> should.equal(_, Ok(0))
+ |> map.get(4)
+ |> should.equal(Ok(0))
m
- |> map.get(_, 1)
- |> should.equal(_, Ok(1))
+ |> map.get(1)
+ |> should.equal(Ok(1))
m
- |> map.get(_, 2)
- |> should.equal(_, Error(Nil))
+ |> map.get(2)
+ |> should.equal(Error(Nil))
}
pub fn insert_test() {
map.new()
- |> map.insert(_, "a", 0)
- |> map.insert(_, "b", 1)
- |> map.insert(_, "c", 2)
- |> should.equal(_, map.from_list([
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- ]))
+ |> map.insert("a", 0)
+ |> map.insert("b", 1)
+ |> map.insert("c", 2)
+ |> should.equal(map.from_list([tuple("a", 0), tuple("b", 1), tuple("c", 2)]))
}
pub fn map_values_test() {
- [
- tuple(1, 0),
- tuple(2, 1),
- tuple(3, 2),
- ]
+ [tuple(1, 0), tuple(2, 1), tuple(3, 2)]
|> map.from_list
- |> map.map_values(_, fn(k, v) { k + v })
- |> should.equal(_, map.from_list([
- tuple(1, 1),
- tuple(2, 3),
- tuple(3, 5),
- ]))
+ |> map.map_values(fn(k, v) { k + v })
+ |> should.equal(map.from_list([tuple(1, 1), tuple(2, 3), tuple(3, 5)]))
}
pub fn keys_test() {
- [
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- ]
+ [tuple("a", 0), tuple("b", 1), tuple("c", 2)]
|> map.from_list
|> map.keys
- |> should.equal(_, ["a", "b", "c"])
+ |> should.equal(["a", "b", "c"])
}
pub fn values_test() {
- [
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- ]
+ [tuple("a", 0), tuple("b", 1), tuple("c", 2)]
|> map.from_list
|> map.values
- |> should.equal(_, [0, 1, 2])
+ |> should.equal([0, 1, 2])
}
pub fn take_test() {
- [
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- ]
+ [tuple("a", 0), tuple("b", 1), tuple("c", 2)]
|> map.from_list
- |> map.take(_, ["a", "b", "d"])
- |> should.equal(_, map.from_list([tuple("a", 0), tuple("b", 1)]))
+ |> map.take(["a", "b", "d"])
+ |> should.equal(map.from_list([tuple("a", 0), tuple("b", 1)]))
}
pub fn drop_test() {
- [
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- ]
+ [tuple("a", 0), tuple("b", 1), tuple("c", 2)]
|> map.from_list
- |> map.drop(_, ["a", "b", "d"])
- |> should.equal(_, map.from_list([tuple("c", 2)]))
+ |> map.drop(["a", "b", "d"])
+ |> should.equal(map.from_list([tuple("c", 2)]))
}
pub fn merge_test() {
- let a = map.from_list([
- tuple("a", 2),
- tuple("c", 4),
- tuple("d", 3),
- ])
-
- let b = map.from_list([
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- ])
+ let a = map.from_list([tuple("a", 2), tuple("c", 4), tuple("d", 3)])
+
+ let b = map.from_list([tuple("a", 0), tuple("b", 1), tuple("c", 2)])
map.merge(a, b)
- |> should.equal(_, map.from_list([
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- tuple("d", 3),
- ]))
+ |> should.equal(
+ map.from_list([tuple("a", 0), tuple("b", 1), tuple("c", 2), tuple("d", 3)]),
+ )
map.merge(b, a)
- |> should.equal(_, map.from_list([
- tuple("a", 2),
- tuple("b", 1),
- tuple("c", 4),
- tuple("d", 3),
- ]))
+ |> should.equal(
+ map.from_list([tuple("a", 2), tuple("b", 1), tuple("c", 4), tuple("d", 3)]),
+ )
}
pub fn delete_test() {
- [
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- ]
+ [tuple("a", 0), tuple("b", 1), tuple("c", 2)]
|> map.from_list
- |> map.delete(_, "a")
- |> map.delete(_, "d")
- |> should.equal(_, map.from_list([tuple("b", 1), tuple("c", 2)]))
+ |> map.delete("a")
+ |> map.delete("d")
+ |> should.equal(map.from_list([tuple("b", 1), tuple("c", 2)]))
}
pub fn update_test() {
- let dict = map.from_list([
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- ])
+ let dict = map.from_list([tuple("a", 0), tuple("b", 1), tuple("c", 2)])
let inc_or_zero = fn(x) {
case x {
@@ -207,56 +140,38 @@ pub fn update_test() {
}
dict
- |> map.update(_, "a", inc_or_zero)
- |> should.equal(_, map.from_list([
- tuple("a", 1),
- tuple("b", 1),
- tuple("c", 2),
- ]))
+ |> map.update("a", inc_or_zero)
+ |> should.equal(map.from_list([tuple("a", 1), tuple("b", 1), tuple("c", 2)]))
dict
- |> map.update(_, "b", inc_or_zero)
- |> should.equal(_, map.from_list([
- tuple("a", 0),
- tuple("b", 2),
- tuple("c", 2),
- ]))
+ |> map.update("b", inc_or_zero)
+ |> should.equal(map.from_list([tuple("a", 0), tuple("b", 2), tuple("c", 2)]))
dict
- |> map.update(_, "z", inc_or_zero)
- |> should.equal(_, map.from_list([
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- tuple("z", 0),
- ]))
+ |> map.update("z", inc_or_zero)
+ |> should.equal(
+ map.from_list([tuple("a", 0), tuple("b", 1), tuple("c", 2), tuple("z", 0)]),
+ )
}
pub fn fold_test() {
- let dict = map.from_list([
- tuple("a", 0),
- tuple("b", 1),
- tuple("c", 2),
- tuple("d", 3),
- ])
-
- let add = fn(_, v, acc) {
- v + acc
- }
+ let dict = map.from_list(
+ [tuple("a", 0), tuple("b", 1), tuple("c", 2), tuple("d", 3)],
+ )
+
+ let add = fn(_, v, acc) { v + acc }
dict
- |> map.fold(_, 0, add)
- |> should.equal(_, 6)
+ |> map.fold(0, add)
+ |> should.equal(6)
- let concat = fn(k, _, acc) {
- string.append(acc, k)
- }
+ let concat = fn(k, _, acc) { string.append(acc, k) }
dict
- |> map.fold(_, "", concat)
- |> should.equal(_, "abcd")
+ |> map.fold("", concat)
+ |> should.equal("abcd")
map.from_list([])
- |> map.fold(_, 0, add)
- |> should.equal(_, 0)
+ |> map.fold(0, add)
+ |> should.equal(0)
}
diff --git a/test/gleam/order_test.gleam b/test/gleam/order_test.gleam
index d071775..4457553 100644
--- a/test/gleam/order_test.gleam
+++ b/test/gleam/order_test.gleam
@@ -3,109 +3,109 @@ import gleam/order.{Lt, Eq, Gt}
pub fn reverse_test() {
order.reverse(Lt)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
order.reverse(order.Eq)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.reverse(Gt)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
}
pub fn to_int_test() {
order.to_int(Lt)
- |> should.equal(_, -1)
+ |> should.equal(-1)
order.to_int(order.Eq)
- |> should.equal(_, 0)
+ |> should.equal(0)
order.to_int(Gt)
- |> should.equal(_, 1)
+ |> should.equal(1)
}
pub fn compare_test() {
order.compare(Lt, Lt)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.compare(Lt, order.Eq)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.compare(Lt, Gt)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.compare(order.Eq, Lt)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
order.compare(order.Eq, order.Eq)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.compare(order.Eq, Gt)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.compare(Gt, Lt)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
order.compare(Gt, order.Eq)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
order.compare(Gt, Gt)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
}
pub fn max_test() {
order.max(Lt, Lt)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.max(Lt, order.Eq)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.max(Lt, Gt)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
order.max(order.Eq, Lt)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.max(order.Eq, order.Eq)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.max(order.Eq, Gt)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
order.max(Gt, Lt)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
order.max(Gt, order.Eq)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
order.max(Gt, Gt)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
}
pub fn min_test() {
order.min(Lt, Lt)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.min(Lt, order.Eq)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.min(Lt, Gt)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.min(order.Eq, Lt)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.min(order.Eq, order.Eq)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.min(order.Eq, Gt)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.min(Gt, Lt)
- |> should.equal(_, Lt)
+ |> should.equal(Lt)
order.min(Gt, order.Eq)
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
order.min(Gt, Gt)
- |> should.equal(_, Gt)
+ |> should.equal(Gt)
}
diff --git a/test/gleam/pair_test.gleam b/test/gleam/pair_test.gleam
index d9a5eb6..6b88887 100644
--- a/test/gleam/pair_test.gleam
+++ b/test/gleam/pair_test.gleam
@@ -4,59 +4,55 @@ import gleam/pair
pub fn first_test() {
tuple(1, 2)
|> pair.first
- |> should.equal(_, 1)
+ |> should.equal(1)
tuple("abc", [])
|> pair.first
- |> should.equal(_, "abc")
+ |> should.equal("abc")
}
pub fn second_test() {
tuple(1, 2)
|> pair.second
- |> should.equal(_, 2)
+ |> should.equal(2)
tuple("abc", [])
|> pair.second
- |> should.equal(_,[])
+ |> should.equal([])
}
pub fn swap_test() {
tuple(1, "2")
|> pair.swap
- |> should.equal(_, tuple("2", 1))
+ |> should.equal(tuple("2", 1))
}
pub fn map_first_test() {
- let inc = fn(a) {
- a + 1
- }
+ let inc = fn(a) { a + 1 }
pair.map_first(tuple(1, 2), inc)
- |> should.equal(_, tuple(2, 2))
+ |> should.equal(tuple(2, 2))
- pair.map_first(tuple(8,2), inc)
- |> should.equal(_, tuple(9, 2))
+ pair.map_first(tuple(8, 2), inc)
+ |> should.equal(tuple(9, 2))
- pair.map_first(tuple(0,-2), inc)
- |> should.equal(_, tuple(1, -2))
+ pair.map_first(tuple(0, -2), inc)
+ |> should.equal(tuple(1, -2))
pair.map_first(tuple(-10, 20), inc)
- |> should.equal(_, tuple(-9, 20))
+ |> should.equal(tuple(-9, 20))
}
pub fn map_second_test() {
- let dec = fn(a) {
- a - 1
- }
+ let dec = fn(a) { a - 1 }
pair.map_second(tuple(1, 2), dec)
- |> should.equal(_, tuple(1, 1))
+ |> should.equal(tuple(1, 1))
- pair.map_second(tuple(8,2), dec)
- |> should.equal(_, tuple(8, 1))
+ pair.map_second(tuple(8, 2), dec)
+ |> should.equal(tuple(8, 1))
- pair.map_second(tuple(0,-2), dec)
- |> should.equal(_, tuple(0, -3))
+ pair.map_second(tuple(0, -2), dec)
+ |> should.equal(tuple(0, -3))
pair.map_second(tuple(-10, 20), dec)
- |> should.equal(_, tuple(-10, 19))
+ |> should.equal(tuple(-10, 19))
}
diff --git a/test/gleam/result_test.gleam b/test/gleam/result_test.gleam
index 2d2f344..7eb55c4 100644
--- a/test/gleam/result_test.gleam
+++ b/test/gleam/result_test.gleam
@@ -19,70 +19,70 @@ pub fn is_error_test() {
pub fn map_test() {
Ok(1)
- |> result.map(_, fn(x) { x + 1 })
- |> should.equal(_, Ok(2))
+ |> result.map(fn(x) { x + 1 })
+ |> should.equal(Ok(2))
Ok(1)
- |> result.map(_, fn(_) { "2" })
- |> should.equal(_, Ok("2"))
+ |> result.map(fn(_) { "2" })
+ |> should.equal(Ok("2"))
Error(1)
- |> result.map(_, fn(x) { x + 1 })
- |> should.equal(_, Error(1))
+ |> result.map(fn(x) { x + 1 })
+ |> should.equal(Error(1))
}
pub fn map_error_test() {
Ok(1)
- |> result.map_error(_, fn(x) { x + 1 })
- |> should.equal(_, Ok(1))
+ |> result.map_error(fn(x) { x + 1 })
+ |> should.equal(Ok(1))
Error(1)
- |> result.map_error(_, fn(x) { tuple("ok", x + 1) })
- |> should.equal(_, Error(tuple("ok", 2)))
+ |> result.map_error(fn(x) { tuple("ok", x + 1) })
+ |> should.equal(Error(tuple("ok", 2)))
}
pub fn flatten_test() {
Ok(Ok(1))
|> result.flatten
- |> should.equal(_, Ok(1))
+ |> should.equal(Ok(1))
Ok(Error(1))
|> result.flatten
- |> should.equal(_, Error(1))
+ |> should.equal(Error(1))
Error(1)
|> result.flatten
- |> should.equal(_, Error(1))
+ |> should.equal(Error(1))
Error(Error(1))
|> result.flatten
- |> should.equal(_, Error(Error(1)))
+ |> should.equal(Error(Error(1)))
}
pub fn then_test() {
Error(1)
- |> result.then(_, fn(x) { Ok(x + 1) })
- |> should.equal(_, Error(1))
+ |> result.then(fn(x) { Ok(x + 1) })
+ |> should.equal(Error(1))
Ok(1)
- |> result.then(_, fn(x) { Ok(x + 1) })
- |> should.equal(_, Ok(2))
+ |> result.then(fn(x) { Ok(x + 1) })
+ |> should.equal(Ok(2))
Ok(1)
- |> result.then(_, fn(_) { Ok("type change") })
- |> should.equal(_, Ok("type change"))
+ |> result.then(fn(_) { Ok("type change") })
+ |> should.equal(Ok("type change"))
Ok(1)
- |> result.then(_, fn(_) { Error(1) })
- |> should.equal(_, Error(1))
+ |> result.then(fn(_) { Error(1) })
+ |> should.equal(Error(1))
}
pub fn unwrap_test() {
Ok(1)
- |> result.unwrap(_, 50)
- |> should.equal(_, 1)
+ |> result.unwrap(50)
+ |> should.equal(1)
Error("nope")
- |> result.unwrap(_, 50)
- |> should.equal(_, 50)
+ |> result.unwrap(50)
+ |> should.equal(50)
}
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam
index 133bdf5..15ace70 100644
--- a/test/gleam/string_test.gleam
+++ b/test/gleam/string_test.gleam
@@ -4,114 +4,108 @@ import gleam/order
pub fn length_test() {
string.length("ß↑e̊")
- |> should.equal(_, 3)
+ |> should.equal(3)
string.length("Gleam")
- |> should.equal(_, 5)
+ |> should.equal(5)
string.length("")
- |> should.equal(_, 0)
+ |> should.equal(0)
}
pub fn lowercase_test() {
string.lowercase("Gleam")
- |> should.equal(_, "gleam")
+ |> should.equal("gleam")
}
pub fn uppercase_test() {
string.uppercase("Gleam")
- |> should.equal(_, "GLEAM")
+ |> should.equal("GLEAM")
}
pub fn reverse_test() {
string.reverse("Gleam")
- |> should.equal(_, "maelG")
+ |> should.equal("maelG")
}
pub fn split_test() {
"Gleam,Erlang,Elixir"
- |> string.split(_, ",")
- |> should.equal(_, ["Gleam", "Erlang", "Elixir"])
+ |> string.split(",")
+ |> should.equal(["Gleam", "Erlang", "Elixir"])
"Gleam, Erlang,Elixir"
- |> string.split(_, ", ")
- |> should.equal(_, ["Gleam", "Erlang,Elixir"])
+ |> string.split(", ")
+ |> should.equal(["Gleam", "Erlang,Elixir"])
}
pub fn replace_test() {
"Gleam,Erlang,Elixir"
- |> string.replace(_, ",", "++")
- |> should.equal(_, "Gleam++Erlang++Elixir")
+ |> string.replace(",", "++")
+ |> should.equal("Gleam++Erlang++Elixir")
}
pub fn append_test() {
"Test"
- |> string.append(_, " Me")
- |> should.equal(_, "Test Me")
+ |> string.append(" Me")
+ |> should.equal("Test Me")
}
pub fn compare_test() {
string.compare("", "")
- |> should.equal(_, order.Eq)
+ |> should.equal(order.Eq)
string.compare("a", "")
- |> should.equal(_, order.Gt)
+ |> should.equal(order.Gt)
string.compare("a", "A")
- |> should.equal(_, order.Gt)
+ |> should.equal(order.Gt)
string.compare("A", "B")
- |> should.equal(_, order.Lt)
+ |> should.equal(order.Lt)
string.compare("t", "ABC")
- |> should.equal(_, order.Gt)
+ |> should.equal(order.Gt)
}
pub fn contains_test() {
- "gleam"
- |> string.contains(_, "ea")
- |> should.equal(_, True)
+ "gleam"
+ |> string.contains("ea")
+ |> should.equal(True)
- "gleam"
- |> string.contains(_, "x")
- |> should.equal(_, False)
+ "gleam"
+ |> string.contains("x")
+ |> should.equal(False)
- string.contains(does: "bellwether", contain: "bell")
- |> should.equal(_, True)
+ string.contains(does: "bellwether", contain: "bell")
+ |> should.equal(True)
}
pub fn concat_test() {
- [
- "Hello", ", ", "world!",
- ]
+ ["Hello", ", ", "world!"]
|> string.concat
- |> should.equal(_, "Hello, world!")
+ |> should.equal("Hello, world!")
}
pub fn repeat_test() {
"hi"
- |> string.repeat(_, times: 3)
- |> should.equal(_, "hihihi")
+ |> string.repeat(times: 3)
+ |> should.equal("hihihi")
"hi"
- |> string.repeat(_, 0)
- |> should.equal(_, "")
+ |> string.repeat(0)
+ |> should.equal("")
"hi"
- |> string.repeat(_, -1)
- |> should.equal(_, "")
+ |> string.repeat(-1)
+ |> should.equal("")
}
pub fn join_test() {
- [
- "Hello", "world!",
- ]
- |> string.join(_, with: ", ")
- |> should.equal(_, "Hello, world!")
-
- [
- "Hello", "world!",
- ]
- |> string.join(_, with: "-")
- |> should.equal(_, "Hello-world!")
+ ["Hello", "world!"]
+ |> string.join(with: ", ")
+ |> should.equal("Hello, world!")
+
+ ["Hello", "world!"]
+ |> string.join(with: "-")
+ |> should.equal("Hello-world!")
}