aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJamie Luck <delucks@users.noreply.github.com>2020-03-29 06:07:06 -0400
committerGitHub <noreply@github.com>2020-03-29 11:07:06 +0100
commiteead09e4fc457b85a5ff6cb990cf293c5d84336c (patch)
tree093af27b46333eda5aea4e7da6f48cc680c77256 /test
parent338ad88b61fda07b008632652b9553c6bf2c0aab (diff)
downloadgleam_stdlib-eead09e4fc457b85a5ff6cb990cf293c5d84336c.tar.gz
gleam_stdlib-eead09e4fc457b85a5ff6cb990cf293c5d84336c.zip
Rename gleam/expect to gleam/should (#27)
Diffstat (limited to 'test')
-rw-r--r--test/gleam/atom_test.gleam18
-rw-r--r--test/gleam/bool_test.gleam34
-rw-r--r--test/gleam/dynamic_test.gleam90
-rw-r--r--test/gleam/float_test.gleam94
-rw-r--r--test/gleam/function_test.gleam20
-rw-r--r--test/gleam/int_test.gleam88
-rw-r--r--test/gleam/iodata_test.gleam32
-rw-r--r--test/gleam/list_test.gleam198
-rw-r--r--test/gleam/map_test.gleam52
-rw-r--r--test/gleam/order_test.gleam68
-rw-r--r--test/gleam/pair_test.gleam28
-rw-r--r--test/gleam/result_test.gleam40
-rw-r--r--test/gleam/string_test.gleam38
13 files changed, 400 insertions, 400 deletions
diff --git a/test/gleam/atom_test.gleam b/test/gleam/atom_test.gleam
index 1f24336..da0699a 100644
--- a/test/gleam/atom_test.gleam
+++ b/test/gleam/atom_test.gleam
@@ -1,45 +1,45 @@
import gleam/atom
-import gleam/expect
+import gleam/should
pub fn from_string_test() {
"ok"
|> atom.from_string
- |> expect.is_ok
+ |> should.be_ok
"expect"
|> atom.from_string
- |> expect.is_ok
+ |> should.be_ok
"this is not an atom we have seen before"
|> atom.from_string
- |> expect.equal(_, Error(atom.AtomNotLoaded))
+ |> should.equal(_, Error(atom.AtomNotLoaded))
}
pub fn create_from_string_test() {
"ok"
|> atom.create_from_string
|> Ok
- |> expect.equal(_, atom.from_string("ok"))
+ |> should.equal(_, atom.from_string("ok"))
"expect"
|> atom.create_from_string
|> Ok
- |> expect.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
- |> expect.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
- |> expect.equal(_, "ok")
+ |> should.equal(_, "ok")
"expect"
|> atom.create_from_string
|> atom.to_string
- |> expect.equal(_, "expect")
+ |> should.equal(_, "expect")
}
diff --git a/test/gleam/bool_test.gleam b/test/gleam/bool_test.gleam
index 8c30579..4e2b8e0 100644
--- a/test/gleam/bool_test.gleam
+++ b/test/gleam/bool_test.gleam
@@ -1,61 +1,61 @@
import gleam/bool
import gleam/order
-import gleam/expect
+import gleam/should
pub fn negate_test() {
bool.negate(True)
- |> expect.false
+ |> should.be_false
bool.negate(False)
- |> expect.true
+ |> should.be_true
}
pub fn compare_test() {
bool.compare(True, True)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
bool.compare(True, False)
- |> expect.equal(_, order.Gt)
+ |> should.equal(_, order.Gt)
bool.compare(False, False)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
bool.compare(False, True)
- |> expect.equal(_, order.Lt)
+ |> should.equal(_, order.Lt)
}
pub fn max_test() {
bool.max(True, True)
- |> expect.equal(_, True)
+ |> should.equal(_, True)
bool.max(True, False)
- |> expect.equal(_, True)
+ |> should.equal(_, True)
bool.max(False, False)
- |> expect.equal(_, False)
+ |> should.equal(_, False)
bool.max(False, True)
- |> expect.equal(_, True)
+ |> should.equal(_, True)
}
pub fn min_test() {
bool.min(True, True)
- |> expect.equal(_, True)
+ |> should.equal(_, True)
bool.min(True, False)
- |> expect.equal(_, False)
+ |> should.equal(_, False)
bool.min(False, False)
- |> expect.equal(_, False)
+ |> should.equal(_, False)
bool.min(False, True)
- |> expect.equal(_, False)
+ |> should.equal(_, False)
}
pub fn to_int_test() {
bool.to_int(True)
- |> expect.equal(_, 1)
+ |> should.equal(_, 1)
bool.to_int(False)
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
}
diff --git a/test/gleam/dynamic_test.gleam b/test/gleam/dynamic_test.gleam
index 2e51517..080e6e7 100644
--- a/test/gleam/dynamic_test.gleam
+++ b/test/gleam/dynamic_test.gleam
@@ -1,7 +1,7 @@
import gleam/dynamic
import gleam/atom
import gleam/list
-import gleam/expect
+import gleam/should
import gleam/result
import gleam/map
@@ -9,116 +9,116 @@ pub fn string_test() {
""
|> dynamic.from
|> dynamic.string
- |> expect.equal(_, Ok(""))
+ |> should.equal(_, Ok(""))
"Hello"
|> dynamic.from
|> dynamic.string
- |> expect.equal(_, Ok("Hello"))
+ |> should.equal(_, Ok("Hello"))
1
|> dynamic.from
|> dynamic.string
- |> expect.equal(_, Error("Expected a String, got `1`"))
+ |> should.equal(_, Error("Expected a String, got `1`"))
[]
|> dynamic.from
|> dynamic.string
- |> expect.equal(_, Error("Expected a String, got `[]`"))
+ |> should.equal(_, Error("Expected a String, got `[]`"))
}
pub fn int_test() {
1
|> dynamic.from
|> dynamic.int
- |> expect.equal(_, Ok(1))
+ |> should.equal(_, Ok(1))
2
|> dynamic.from
|> dynamic.int
- |> expect.equal(_, Ok(2))
+ |> should.equal(_, Ok(2))
1.0
|> dynamic.from
|> dynamic.int
- |> expect.equal(_, Error("Expected an Int, got `1.0`"))
+ |> should.equal(_, Error("Expected an Int, got `1.0`"))
[]
|> dynamic.from
|> dynamic.int
- |> expect.equal(_, Error("Expected an Int, got `[]`"))
+ |> should.equal(_, Error("Expected an Int, got `[]`"))
}
pub fn float_test() {
1.0
|> dynamic.from
|> dynamic.float
- |> expect.equal(_, Ok(1.0))
+ |> should.equal(_, Ok(1.0))
2.2
|> dynamic.from
|> dynamic.float
- |> expect.equal(_, Ok(2.2))
+ |> should.equal(_, Ok(2.2))
1
|> dynamic.from
|> dynamic.float
- |> expect.equal(_, Error("Expected a Float, got `1`"))
+ |> should.equal(_, Error("Expected a Float, got `1`"))
[]
|> dynamic.from
|> dynamic.float
- |> expect.equal(_, Error("Expected a Float, got `[]`"))
+ |> should.equal(_, Error("Expected a Float, got `[]`"))
}
pub fn thunk_test() {
fn() { 1 }
|> dynamic.from
|> dynamic.thunk
- |> expect.is_ok
+ |> should.be_ok
fn() { 1 }
|> dynamic.from
|> dynamic.thunk
|> result.map(_, fn(f) { f() })
- |> expect.equal(_, Ok(dynamic.from(1)))
+ |> should.equal(_, Ok(dynamic.from(1)))
fn(x) { x }
|> dynamic.from
|> dynamic.thunk
- |> expect.is_error
+ |> should.be_error
1
|> dynamic.from
|> dynamic.thunk
- |> expect.is_error
+ |> should.be_error
[]
|> dynamic.from
|> dynamic.thunk
- |> expect.is_error
+ |> should.be_error
}
pub fn bool_test() {
True
|> dynamic.from
|> dynamic.bool
- |> expect.equal(_, Ok(True))
+ |> should.equal(_, Ok(True))
False
|> dynamic.from
|> dynamic.bool
- |> expect.equal(_, Ok(False))
+ |> should.equal(_, Ok(False))
1
|> dynamic.from
|> dynamic.bool
- |> expect.equal(_, Error("Expected a Bool, got `1`"))
+ |> should.equal(_, Error("Expected a Bool, got `1`"))
[]
|> dynamic.from
|> dynamic.bool
- |> expect.equal(_, Error("Expected a Bool, got `[]`"))
+ |> should.equal(_, Error("Expected a Bool, got `[]`"))
}
pub fn atom_test() {
@@ -126,65 +126,65 @@ pub fn atom_test() {
|> atom.create_from_string
|> dynamic.from
|> dynamic.atom
- |> expect.equal(_, Ok(atom.create_from_string("")))
+ |> should.equal(_, Ok(atom.create_from_string("")))
"ok"
|> atom.create_from_string
|> dynamic.from
|> dynamic.atom
- |> expect.equal(_, Ok(atom.create_from_string("ok")))
+ |> should.equal(_, Ok(atom.create_from_string("ok")))
1
|> dynamic.from
|> dynamic.atom
- |> expect.is_error
+ |> should.be_error
[]
|> dynamic.from
|> dynamic.atom
- |> expect.is_error
+ |> should.be_error
}
pub fn list_test() {
[]
|> dynamic.from
|> dynamic.list(_, dynamic.string)
- |> expect.equal(_, Ok([]))
+ |> should.equal(_, Ok([]))
[]
|> dynamic.from
|> dynamic.list(_, dynamic.int)
- |> expect.equal(_, Ok([]))
+ |> should.equal(_, Ok([]))
[1, 2, 3]
|> dynamic.from
|> dynamic.list(_, dynamic.int)
- |> expect.equal(_, Ok([1, 2, 3]))
+ |> should.equal(_, Ok([1, 2, 3]))
[[1], [2], [3]]
|> dynamic.from
|> dynamic.list(_, dynamic.list(_, dynamic.int))
- |> expect.equal(_, Ok([[1], [2], [3]]))
+ |> should.equal(_, Ok([[1], [2], [3]]))
1
|> dynamic.from
|> dynamic.list(_, dynamic.string)
- |> expect.is_error
+ |> should.be_error
1.0
|> dynamic.from
|> dynamic.list(_, dynamic.int)
- |> expect.is_error
+ |> should.be_error
[""]
|> dynamic.from
|> dynamic.list(_, dynamic.int)
- |> expect.is_error
+ |> should.be_error
[dynamic.from(1), dynamic.from("not an int")]
|> dynamic.from
|> dynamic.list(_, dynamic.int)
- |> expect.is_error
+ |> should.be_error
}
pub fn field_test() {
@@ -195,29 +195,29 @@ pub fn field_test() {
|> map.insert(_, ok_atom, 1)
|> dynamic.from
|> dynamic.field(_, ok_atom)
- |> expect.equal(_, Ok(dynamic.from(1)))
+ |> should.equal(_, Ok(dynamic.from(1)))
map.new()
|> map.insert(_, ok_atom, 3)
|> map.insert(_, error_atom, 1)
|> dynamic.from
|> dynamic.field(_, ok_atom)
- |> expect.equal(_, Ok(dynamic.from(3)))
+ |> should.equal(_, Ok(dynamic.from(3)))
map.new()
|> dynamic.from
|> dynamic.field(_, ok_atom)
- |> expect.is_error
+ |> should.be_error
1
|> dynamic.from
|> dynamic.field(_, ok_atom)
- |> expect.is_error
+ |> should.be_error
[]
|> dynamic.from
|> dynamic.field(_, [])
- |> expect.is_error
+ |> should.be_error
}
pub fn element_test() {
@@ -227,31 +227,31 @@ pub fn element_test() {
ok_one_tuple
|> dynamic.from
|> dynamic.element(_, 0)
- |> expect.equal(_, Ok(dynamic.from(ok_atom)))
+ |> should.equal(_, Ok(dynamic.from(ok_atom)))
ok_one_tuple
|> dynamic.from
|> dynamic.element(_, 1)
- |> expect.equal(_, Ok(dynamic.from(1)))
+ |> should.equal(_, Ok(dynamic.from(1)))
ok_one_tuple
|> dynamic.from
|> dynamic.element(_, 2)
- |> expect.is_error
+ |> should.be_error
ok_one_tuple
|> dynamic.from
|> dynamic.element(_, -1)
- |> expect.is_error
+ |> should.be_error
1
|> dynamic.from
|> dynamic.element(_, 0)
- |> expect.is_error
+ |> should.be_error
map.new()
|> map.insert(_, 1, ok_atom)
|> dynamic.from
|> dynamic.element(_, 0)
- |> expect.is_error
+ |> should.be_error
}
diff --git a/test/gleam/float_test.gleam b/test/gleam/float_test.gleam
index f10565c..038801a 100644
--- a/test/gleam/float_test.gleam
+++ b/test/gleam/float_test.gleam
@@ -1,185 +1,185 @@
-import gleam/expect
+import gleam/should
import gleam/float
import gleam/order
pub fn parse_test() {
"1.23"
|> float.parse
- |> expect.equal(_, Ok(1.23))
+ |> should.equal(_, Ok(1.23))
"5.0"
|> float.parse
- |> expect.equal(_, Ok(5.0))
+ |> should.equal(_, Ok(5.0))
"0.123456789"
|> float.parse
- |> expect.equal(_, Ok(0.123456789))
+ |> should.equal(_, Ok(0.123456789))
""
|> float.parse
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
"what"
|> float.parse
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
"1"
|> float.parse
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
pub fn to_string_test() {
123.0
|> float.to_string
- |> expect.equal(_, "123.0")
+ |> should.equal(_, "123.0")
-8.1
|> float.to_string
- |> expect.equal(_, "-8.1")
+ |> should.equal(_, "-8.1")
}
pub fn compare_test() {
float.compare(0., 0.)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
float.compare(0.1, 0.1)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
float.compare(0., 0.1)
- |> expect.equal(_, order.Lt)
+ |> should.equal(_, order.Lt)
float.compare(-2., -1.9)
- |> expect.equal(_, order.Lt)
+ |> should.equal(_, order.Lt)
float.compare(2., 1.9)
- |> expect.equal(_, order.Gt)
+ |> should.equal(_, order.Gt)
float.compare(-1.9, -2.)
- |> expect.equal(_, order.Gt)
+ |> should.equal(_, order.Gt)
}
pub fn ceiling_test() {
8.1
|> float.ceiling
- |> expect.equal(_, 9.0)
+ |> should.equal(_, 9.0)
-8.1
|> float.ceiling
- |> expect.equal(_, -8.0)
+ |> should.equal(_, -8.0)
-8.0
|> float.ceiling
- |> expect.equal(_, -8.0)
+ |> should.equal(_, -8.0)
}
pub fn floor_test() {
8.1
|> float.floor
- |> expect.equal(_, 8.0)
+ |> should.equal(_, 8.0)
-8.1
|> float.floor
- |> expect.equal(_, -9.0)
+ |> should.equal(_, -9.0)
-8.0
|> float.floor
- |> expect.equal(_, -8.0)
+ |> should.equal(_, -8.0)
}
pub fn round_test() {
8.1
|> float.round
- |> expect.equal(_, 8)
+ |> should.equal(_, 8)
8.4
|> float.round
- |> expect.equal(_, 8)
+ |> should.equal(_, 8)
8.499
|> float.round
- |> expect.equal(_, 8)
+ |> should.equal(_, 8)
8.5
|> float.round
- |> expect.equal(_, 9)
+ |> should.equal(_, 9)
-8.1
|> float.round
- |> expect.equal(_, -8)
+ |> should.equal(_, -8)
-7.5
|> float.round
- |> expect.equal(_, -8)
+ |> should.equal(_, -8)
}
pub fn truncate_test() {
8.1
|> float.truncate
- |> expect.equal(_, 8)
+ |> should.equal(_, 8)
8.4
|> float.truncate
- |> expect.equal(_, 8)
+ |> should.equal(_, 8)
8.499
|> float.truncate
- |> expect.equal(_, 8)
+ |> should.equal(_, 8)
8.5
|> float.truncate
- |> expect.equal(_, 8)
+ |> should.equal(_, 8)
-8.1
|> float.truncate
- |> expect.equal(_, -8)
+ |> should.equal(_, -8)
-7.5
|> float.truncate
- |> expect.equal(_, -7)
+ |> should.equal(_, -7)
}
pub fn min_test() {
float.min(0., 0.)
- |> expect.equal(_, 0.)
+ |> should.equal(_, 0.)
float.min(0.3, 1.5)
- |> expect.equal(_, 0.3)
+ |> should.equal(_, 0.3)
float.min(1., 0.)
- |> expect.equal(_, 0.)
+ |> should.equal(_, 0.)
float.min(-1.7, 2.5)
- |> expect.equal(_, -1.7)
+ |> should.equal(_, -1.7)
float.min(-2.2, -2.2)
- |> expect.equal(_, -2.2)
+ |> should.equal(_, -2.2)
float.min(-1., -1.)
- |> expect.equal(_, -1.)
+ |> should.equal(_, -1.)
float.min(-1.1, -1.)
- |> expect.equal(_, -1.1)
+ |> should.equal(_, -1.1)
}
pub fn max_test() {
float.max(0., 0.)
- |> expect.equal(_, 0.)
+ |> should.equal(_, 0.)
float.max(0.3, 1.5)
- |> expect.equal(_, 1.5)
+ |> should.equal(_, 1.5)
float.max(1., 0.)
- |> expect.equal(_, 1.)
+ |> should.equal(_, 1.)
float.max(-1.7, 2.5)
- |> expect.equal(_, 2.5)
+ |> should.equal(_, 2.5)
float.max(-2.2, -2.2)
- |> expect.equal(_, -2.2)
+ |> should.equal(_, -2.2)
float.max(-1., -1.)
- |> expect.equal(_, -1.)
+ |> should.equal(_, -1.)
float.max(-1.1, -1.)
- |> expect.equal(_, -1.)
+ |> should.equal(_, -1.)
}
diff --git a/test/gleam/function_test.gleam b/test/gleam/function_test.gleam
index 1c3b4b8..ee4fc00 100644
--- a/test/gleam/function_test.gleam
+++ b/test/gleam/function_test.gleam
@@ -1,4 +1,4 @@
-import gleam/expect
+import gleam/should
import gleam/function
import gleam/int
import gleam/list
@@ -13,7 +13,7 @@ pub fn compose_test() {
1
|> add_five
- |> expect.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)
@@ -24,11 +24,11 @@ pub fn compose_test() {
[1]
|> head_to_string
- |> expect.equal(_, "1")
+ |> should.equal(_, "1")
[]
|> head_to_string
- |> expect.equal(_, "0")
+ |> should.equal(_, "0")
}
pub fn flip_test() {
@@ -43,26 +43,26 @@ pub fn flip_test() {
let flipped_fun = function.flip(fun)
fun("Bob", 1)
- |> expect.equal(_, "String: 'Bob', Int: '1'")
+ |> should.equal(_, "String: 'Bob', Int: '1'")
flipped_fun(2, "Alice")
- |> expect.equal(_, "String: 'Alice', Int: '2'")
+ |> should.equal(_, "String: 'Alice', Int: '2'")
}
pub fn identity_test() {
1
|> function.identity
- |> expect.equal(_, 1)
+ |> should.equal(_, 1)
""
|> function.identity
- |> expect.equal(_, "")
+ |> should.equal(_, "")
[]
|> function.identity
- |> expect.equal(_, [])
+ |> should.equal(_, [])
tuple(1, 2.0)
|> function.identity
- |> expect.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 98428d1..267645b 100644
--- a/test/gleam/int_test.gleam
+++ b/test/gleam/int_test.gleam
@@ -1,159 +1,159 @@
-import gleam/expect
+import gleam/should
import gleam/int
import gleam/order
pub fn to_string() {
123
|> int.to_string
- |> expect.equal(_, "123")
+ |> should.equal(_, "123")
-123
|> int.to_string
- |> expect.equal(_, "-123")
+ |> should.equal(_, "-123")
0123
|> int.to_string
- |> expect.equal(_, "123")
+ |> should.equal(_, "123")
}
pub fn parse() {
"123"
|> int.parse
- |> expect.equal(_, Ok(123))
+ |> should.equal(_, Ok(123))
"-123"
|> int.parse
- |> expect.equal(_, Ok(-123))
+ |> should.equal(_, Ok(-123))
"0123"
|> int.parse
- |> expect.equal(_, Ok(123))
+ |> should.equal(_, Ok(123))
""
|> int.parse
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
"what"
|> int.parse
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
"1.23"
|> int.parse
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
pub fn to_base_string() {
100
|> int.to_base_string(_, 16)
- |> expect.equal(_, "64")
+ |> should.equal(_, "64")
-100
|> int.to_base_string(_, 16)
- |> expect.equal(_, "-64")
+ |> should.equal(_, "-64")
}
pub fn compare_test() {
int.compare(0, 0)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
int.compare(1, 1)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
int.compare(0, 1)
- |> expect.equal(_, order.Lt)
+ |> should.equal(_, order.Lt)
int.compare(-2, -1)
- |> expect.equal(_, order.Lt)
+ |> should.equal(_, order.Lt)
int.compare(2, 1)
- |> expect.equal(_, order.Gt)
+ |> should.equal(_, order.Gt)
int.compare(-1, -2)
- |> expect.equal(_, order.Gt)
+ |> should.equal(_, order.Gt)
}
pub fn min_test() {
int.min(0, 0)
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
int.min(0, 1)
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
int.min(1, 0)
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
int.min(-1, 2)
- |> expect.equal(_, -1)
+ |> should.equal(_, -1)
int.min(2, -2)
- |> expect.equal(_, -2)
+ |> should.equal(_, -2)
int.min(-1, -1)
- |> expect.equal(_, -1)
+ |> should.equal(_, -1)
}
pub fn max_test() {
int.max(0, 0)
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
int.max(0, 1)
- |> expect.equal(_, 1)
+ |> should.equal(_, 1)
int.max(1, 0)
- |> expect.equal(_, 1)
+ |> should.equal(_, 1)
int.max(-1, 2)
- |> expect.equal(_, 2)
+ |> should.equal(_, 2)
int.max(2, -2)
- |> expect.equal(_, 2)
+ |> should.equal(_, 2)
int.max(-1, -1)
- |> expect.equal(_, -1)
+ |> should.equal(_, -1)
}
pub fn is_even_test() {
int.is_even(0)
- |> expect.true
+ |> should.be_true
int.is_even(2)
- |> expect.true
+ |> should.be_true
int.is_even(-2)
- |> expect.true
+ |> should.be_true
int.is_even(10006)
- |> expect.true
+ |> should.be_true
int.is_even(1)
- |> expect.false
+ |> should.be_false
int.is_even(-3)
- |> expect.false
+ |> should.be_false
int.is_even(10005)
- |> expect.false
+ |> should.be_false
}
pub fn is_odd_test() {
int.is_odd(0)
- |> expect.false
+ |> should.be_false
int.is_odd(2)
- |> expect.false
+ |> should.be_false
int.is_odd(-2)
- |> expect.false
+ |> should.be_false
int.is_odd(10006)
- |> expect.false
+ |> should.be_false
int.is_odd(1)
- |> expect.true
+ |> should.be_true
int.is_odd(-3)
- |> expect.true
+ |> should.be_true
int.is_odd(10005)
- |> expect.true
+ |> should.be_true
}
diff --git a/test/gleam/iodata_test.gleam b/test/gleam/iodata_test.gleam
index 0b0e248..e9922e4 100644
--- a/test/gleam/iodata_test.gleam
+++ b/test/gleam/iodata_test.gleam
@@ -1,4 +1,4 @@
-import gleam/expect
+import gleam/should
import gleam/iodata
pub fn iodata_test() {
@@ -9,11 +9,11 @@ pub fn iodata_test() {
data
|> iodata.to_string
- |> expect.equal(_, "Hello, world!")
+ |> should.equal(_, "Hello, world!")
data
|> iodata.byte_size
- |> expect.equal(_, 13)
+ |> should.equal(_, 13)
let data = iodata.new("ello")
|> iodata.append_iodata(_, iodata.new(","))
@@ -22,11 +22,11 @@ pub fn iodata_test() {
data
|> iodata.to_string
- |> expect.equal(_, "Hello, world!")
+ |> should.equal(_, "Hello, world!")
data
|> iodata.byte_size
- |> expect.equal(_, 13)
+ |> should.equal(_, 13)
}
pub fn lowercase_test() {
@@ -34,7 +34,7 @@ pub fn lowercase_test() {
|> iodata.from_strings
|> iodata.lowercase
|> iodata.to_string
- |> expect.equal(_, "gleamgleam")
+ |> should.equal(_, "gleamgleam")
}
pub fn uppercase_test() {
@@ -42,49 +42,49 @@ pub fn uppercase_test() {
|> iodata.from_strings
|> iodata.uppercase
|> iodata.to_string
- |> expect.equal(_, "GLEAMGLEAM")
+ |> should.equal(_, "GLEAMGLEAM")
}
pub fn split_test() {
"Gleam,Erlang,Elixir"
|> iodata.new
|> iodata.split(_, ",")
- |> expect.equal(_, [iodata.new("Gleam"), iodata.new("Erlang"), iodata.new("Elixir")])
+ |> should.equal(_, [iodata.new("Gleam"), iodata.new("Erlang"), iodata.new("Elixir")])
["Gleam, Erl", "ang,Elixir"]
|> iodata.from_strings
|> iodata.split(_, ", ")
- |> expect.equal(_, [iodata.new("Gleam"), iodata.from_strings(["Erl", "ang,Elixir"])])
+ |> 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"]))
- |> expect.true
+ |> should.be_true
iodata.new("12")
|> iodata.is_equal(_, iodata.new("12"))
- |> expect.true
+ |> should.be_true
iodata.new("12")
|> iodata.is_equal(_, iodata.new("2"))
- |> expect.false
+ |> should.be_false
}
pub fn is_empty_test() {
iodata.new("")
|> iodata.is_empty
- |> expect.true
+ |> should.be_true
iodata.new("12")
|> iodata.is_empty
- |> expect.false
+ |> should.be_false
iodata.from_strings([])
|> iodata.is_empty
- |> expect.true
+ |> should.be_true
iodata.from_strings(["", ""])
|> iodata.is_empty
- |> expect.true
+ |> should.be_true
}
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index ee29ce8..d54fe8f 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -1,4 +1,4 @@
-import gleam/expect
+import gleam/should
import gleam/list
import gleam/int
import gleam/float
@@ -7,79 +7,79 @@ import gleam/pair
pub fn length_test() {
list.length([])
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
list.length([1])
- |> expect.equal(_, 1)
+ |> should.equal(_, 1)
list.length([1, 1])
- |> expect.equal(_, 2)
+ |> should.equal(_, 2)
list.length([1, 1, 1])
- |> expect.equal(_, 3)
+ |> should.equal(_, 3)
}
pub fn reverse_test() {
- list.reverse([]) |> expect.equal(_, [])
- list.reverse([1, 2, 3, 4, 5]) |> expect.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([]) |> expect.true
- list.is_empty([1]) |> expect.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) |> expect.true
- list.contains([0, 4, 5, 7], 1) |> expect.false
- list.contains([], 1) |> expect.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])
- |> expect.equal(_, Ok(0))
+ |> should.equal(_, Ok(0))
list.head([])
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
pub fn tail_test() {
list.tail([0, 4, 5, 7])
- |> expect.equal(_, Ok([4, 5, 7]))
+ |> should.equal(_, Ok([4, 5, 7]))
list.tail([0])
- |> expect.equal(_, Ok([]))
+ |> should.equal(_, Ok([]))
list.tail([])
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
pub fn filter_test() {
[]
|> list.filter(_, fn(_) { True })
- |> expect.equal(_, [])
+ |> should.equal(_, [])
[0, 4, 5, 7, 3]
|> list.filter(_, fn(_) { True })
- |> expect.equal(_, [0, 4, 5, 7, 3])
+ |> should.equal(_, [0, 4, 5, 7, 3])
[0, 4, 5, 7, 3]
|> list.filter(_, fn(x) { x > 4 })
- |> expect.equal(_, [5, 7])
+ |> should.equal(_, [5, 7])
[0, 4, 5, 7, 3]
|> list.filter(_, fn(x) { x < 4 })
- |> expect.equal(_, [0, 3])
+ |> should.equal(_, [0, 3])
}
pub fn map_test() {
[]
|> list.map(_, fn(x) { x * 2 })
- |> expect.equal(_, [])
+ |> should.equal(_, [])
[0, 4, 5, 7, 3]
|> list.map(_, fn(x) { x * 2 })
- |> expect.equal(_, [0, 8, 10, 14, 6])
+ |> should.equal(_, [0, 8, 10, 14, 6])
}
pub fn traverse_test() {
@@ -92,65 +92,65 @@ pub fn traverse_test() {
[5, 6, 5, 6]
|> list.traverse(_, fun)
- |> expect.equal(_, Ok([10, 12, 10, 12]))
+ |> should.equal(_, Ok([10, 12, 10, 12]))
[4, 6, 5, 7, 3]
|> list.traverse(_, fun)
- |> expect.equal(_, Error(7))
+ |> should.equal(_, Error(7))
}
pub fn drop_test() {
[]
|> list.drop(_, 5)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
[1, 2, 3, 4, 5, 6, 7, 8]
|> list.drop(_, 5)
- |> expect.equal(_, [6, 7, 8])
+ |> should.equal(_, [6, 7, 8])
}
pub fn take_test() {
[]
|> list.take(_, 5)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
[1, 2, 3, 4, 5, 6, 7, 8]
|> list.take(_, 5)
- |> expect.equal(_, [1, 2, 3, 4, 5])
+ |> should.equal(_, [1, 2, 3, 4, 5])
}
pub fn new_test() {
- list.new() |> expect.equal(_, [])
+ list.new() |> should.equal(_, [])
}
pub fn append_test() {
list.append([1], [2, 3])
- |> expect.equal(_, [1, 2, 3])
+ |> should.equal(_, [1, 2, 3])
}
pub fn flatten_test() {
list.flatten([])
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.flatten([[]])
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.flatten([[], [], []])
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.flatten([[1, 2], [], [3, 4]])
- |> expect.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] })
- |> expect.equal(_, [3, 2, 1])
+ |> should.equal(_, [3, 2, 1])
}
pub fn fold_right_test() {
[1, 2, 3]
|> list.fold_right(_, from: [], with: fn(x, acc) { [x | acc] })
- |> expect.equal(_, [1, 2, 3])
+ |> should.equal(_, [1, 2, 3])
}
pub fn find_map_test() {
@@ -163,15 +163,15 @@ pub fn find_map_test() {
[1, 2, 3]
|> list.find_map(_, with: f)
- |> expect.equal(_, Ok(4))
+ |> should.equal(_, Ok(4))
[1, 3, 2]
|> list.find_map(_, with: f)
- |> expect.equal(_, Ok(4))
+ |> should.equal(_, Ok(4))
[1, 3]
|> list.find_map(_, with: f)
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
pub fn find_test() {
@@ -181,222 +181,222 @@ pub fn find_test() {
[1, 2, 3]
|> list.find(_, one_that: is_two)
- |> expect.equal(_, Ok(2))
+ |> should.equal(_, Ok(2))
[1, 3, 2]
|> list.find(_, one_that: is_two)
- |> expect.equal(_, Ok(2))
+ |> should.equal(_, Ok(2))
[1, 3]
|> list.find(_, one_that: is_two)
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
pub fn all_test() {
list.all([1, 2, 3, 4, 5], fn(x) { x > 0 })
- |> expect.equal(_, True)
+ |> should.equal(_, True)
list.all([1, 2, 3, 4, 5], fn(x) { x < 0 })
- |> expect.equal(_, False)
+ |> should.equal(_, False)
list.all([], fn(_) { False })
- |> expect.equal(_, True)
+ |> should.equal(_, True)
}
pub fn any_test() {
list.any([1, 2, 3, 4, 5], fn(x) { x == 2 })
- |> expect.equal(_, True)
+ |> should.equal(_, True)
list.any([1, 2, 3, 4, 5], fn(x) { x < 0 })
- |> expect.equal(_, False)
+ |> should.equal(_, False)
list.any([], fn(_) { False })
- |> expect.equal(_, False)
+ |> should.equal(_, False)
}
pub fn zip_test() {
list.zip([], [1, 2, 3])
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.zip([1, 2], [])
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.zip([1, 2, 3], [4, 5, 6])
- |> expect.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])
- |> expect.equal(_, [tuple(5, 1), tuple(6, 2)])
+ |> should.equal(_, [tuple(5, 1), tuple(6, 2)])
list.zip([5, 6, 7], [1, 2])
- |> expect.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])
- |> expect.equal(_, Error(list.LengthMismatch))
+ |> should.equal(_, Error(list.LengthMismatch))
list.strict_zip([1, 2], [])
- |> expect.equal(_, Error(list.LengthMismatch))
+ |> should.equal(_, Error(list.LengthMismatch))
list.strict_zip([1, 2, 3], [4, 5, 6])
- |> expect.equal(_, Ok([
+ |> should.equal(_, Ok([
tuple(1, 4),
tuple(2, 5),
tuple(3, 6),
]))
list.strict_zip([5, 6], [1, 2, 3])
- |> expect.equal(_, Error(list.LengthMismatch))
+ |> should.equal(_, Error(list.LengthMismatch))
list.strict_zip([5, 6, 7], [1, 2])
- |> expect.equal(_, Error(list.LengthMismatch))
+ |> should.equal(_, Error(list.LengthMismatch))
}
pub fn intersperse_test() {
list.intersperse([1, 2, 3], 4)
- |> expect.equal(_, [1, 4, 2, 4, 3])
+ |> should.equal(_, [1, 4, 2, 4, 3])
list.intersperse([], 2)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
}
pub fn at_test() {
list.at([1, 2, 3], 2)
- |> expect.equal(_, Ok(3))
+ |> should.equal(_, Ok(3))
list.at([1, 2, 3], 5)
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
list.at([], 0)
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
list.at([1, 2, 3, 4, 5, 6], -1)
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
pub fn unique_test() {
list.unique([1, 1, 2, 3, 4, 4, 4, 5, 6])
- |> expect.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])
- |> expect.equal(_, [7, 1, 45, 6, 2, 47, 5])
+ |> should.equal(_, [7, 1, 45, 6, 2, 47, 5])
list.unique([3, 4, 5])
- |> expect.equal(_, [3, 4, 5])
+ |> should.equal(_, [3, 4, 5])
list.unique([])
- |> expect.equal(_, [])
+ |> should.equal(_, [])
}
pub fn sort_test() {
[4, 3, 6, 5, 4]
|> list.sort(_, int.compare)
- |> expect.equal(_, [3, 4, 4, 5, 6])
+ |> should.equal(_, [3, 4, 4, 5, 6])
[4, 3, 6, 5, 4, 1]
|> list.sort(_, int.compare)
- |> expect.equal(_, [1, 3, 4, 4, 5, 6])
+ |> should.equal(_, [1, 3, 4, 4, 5, 6])
[4.1, 3.1, 6.1, 5.1, 4.1]
|> list.sort(_, float.compare)
- |> expect.equal(_, [3.1, 4.1, 4.1, 5.1, 6.1])
+ |> should.equal(_, [3.1, 4.1, 4.1, 5.1, 6.1])
[]
|> list.sort(_, int.compare)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
}
pub fn index_map_test() {
list.index_map([3, 4, 5], fn(i, x) { tuple(i, x) })
- |> expect.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))
}
list.index_map(["a", "b", "c"], f)
- |> expect.equal(_, ["a0", "b1", "c2"])
+ |> should.equal(_, ["a0", "b1", "c2"])
}
pub fn range_test() {
list.range(0, 0)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.range(1, 1)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.range(-1, -1)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.range(0, 1)
- |> expect.equal(_, [0])
+ |> should.equal(_, [0])
list.range(0, 5)
- |> expect.equal(_, [0, 1, 2, 3, 4])
+ |> should.equal(_, [0, 1, 2, 3, 4])
list.range(1, -5)
- |> expect.equal(_, [1, 0, -1, -2, -3, -4])
+ |> should.equal(_, [1, 0, -1, -2, -3, -4])
}
pub fn repeat_test() {
list.repeat(1, -10)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.repeat(1, 0)
- |> expect.equal(_, [])
+ |> should.equal(_, [])
list.repeat(2, 3)
- |> expect.equal(_, [2, 2, 2])
+ |> should.equal(_, [2, 2, 2])
list.repeat("x", 5)
- |> expect.equal(_, ["x", "x", "x", "x", "x"])
+ |> should.equal(_, ["x", "x", "x", "x", "x"])
}
pub fn split_test() {
[]
|> list.split(_, 0)
- |> expect.equal(_, tuple([], []))
+ |> should.equal(_, tuple([], []))
[0, 1, 2, 3, 4]
|> list.split(_, 0)
- |> expect.equal(_, tuple([], [0, 1, 2, 3, 4]))
+ |> should.equal(_, tuple([], [0, 1, 2, 3, 4]))
[0, 1, 2, 3, 4]
|> list.split(_, -2)
- |> expect.equal(_, tuple([], [0, 1, 2, 3, 4]))
+ |> should.equal(_, tuple([], [0, 1, 2, 3, 4]))
[0, 1, 2, 3, 4]
|> list.split(_, 1)
- |> expect.equal(_, tuple([0], [1, 2, 3, 4]))
+ |> should.equal(_, tuple([0], [1, 2, 3, 4]))
[0, 1, 2, 3, 4]
|> list.split(_, 3)
- |> expect.equal(_, tuple([0, 1, 2], [3, 4]))
+ |> should.equal(_, tuple([0, 1, 2], [3, 4]))
[0, 1, 2, 3, 4]
|> list.split(_, 9)
- |> expect.equal(_, tuple([0, 1, 2, 3, 4], []))
+ |> should.equal(_, tuple([0, 1, 2, 3, 4], []))
}
pub fn split_while_test() {
[]
|> list.split_while(_, fn(x) { x <= 5 })
- |> expect.equal(_, tuple([], []))
+ |> should.equal(_, tuple([], []))
[1, 2, 3, 4, 5]
|> list.split_while(_, fn(x) { x <= 5 })
- |> expect.equal(_, tuple([1, 2, 3, 4, 5], []))
+ |> should.equal(_, tuple([1, 2, 3, 4, 5], []))
[1, 2, 3, 4, 5]
|> list.split_while(_, fn(x) { x == 2 })
- |> expect.equal(_, tuple([], [1, 2, 3, 4, 5]))
+ |> should.equal(_, tuple([], [1, 2, 3, 4, 5]))
[1, 2, 3, 4, 5]
|> list.split_while(_, fn(x) { x <= 3 })
- |> expect.equal(_, tuple([1, 2, 3], [4, 5]))
+ |> should.equal(_, tuple([1, 2, 3], [4, 5]))
[1, 2, 3, 4, 5]
|> list.split_while(_, fn(x) { x <= -3 })
- |> expect.equal(_, tuple([], [1, 2, 3, 4, 5]))
+ |> should.equal(_, tuple([], [1, 2, 3, 4, 5]))
}
@@ -405,13 +405,13 @@ pub fn key_find_test() {
proplist
|> list.key_find(_, 0)
- |> expect.equal(_, Ok("1"))
+ |> should.equal(_, Ok("1"))
proplist
|> list.key_find(_, 1)
- |> expect.equal(_, Ok("2"))
+ |> should.equal(_, Ok("2"))
proplist
|> list.key_find(_, 2)
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
diff --git a/test/gleam/map_test.gleam b/test/gleam/map_test.gleam
index 6dcd3a1..27e47f6 100644
--- a/test/gleam/map_test.gleam
+++ b/test/gleam/map_test.gleam
@@ -1,5 +1,5 @@
import gleam/string
-import gleam/expect
+import gleam/should
import gleam/map
pub fn from_list_test() {
@@ -9,21 +9,21 @@ pub fn from_list_test() {
]
|> map.from_list
|> map.size
- |> expect.equal(_, 2)
+ |> should.equal(_, 2)
}
pub fn has_key_test() {
[]
|> map.from_list
|> map.has_key(_, 1)
- |> expect.false
+ |> should.be_false
[
tuple(1, 0),
]
|> map.from_list
|> map.has_key(_, 1)
- |> expect.true
+ |> should.be_true
[
tuple(4, 0),
@@ -31,7 +31,7 @@ pub fn has_key_test() {
]
|> map.from_list
|> map.has_key(_, 1)
- |> expect.true
+ |> should.be_true
[
tuple(4, 0),
@@ -39,17 +39,17 @@ pub fn has_key_test() {
]
|> map.from_list
|> map.has_key(_, 0)
- |> expect.false
+ |> should.be_false
}
pub fn new_test() {
map.new()
|> map.size
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
map.new()
|> map.to_list
- |> expect.equal(_, [])
+ |> should.equal(_, [])
}
pub fn get_test() {
@@ -61,15 +61,15 @@ pub fn get_test() {
m
|> map.get(_, 4)
- |> expect.equal(_, Ok(0))
+ |> should.equal(_, Ok(0))
m
|> map.get(_, 1)
- |> expect.equal(_, Ok(1))
+ |> should.equal(_, Ok(1))
m
|> map.get(_, 2)
- |> expect.equal(_, Error(Nil))
+ |> should.equal(_, Error(Nil))
}
pub fn insert_test() {
@@ -77,7 +77,7 @@ pub fn insert_test() {
|> map.insert(_, "a", 0)
|> map.insert(_, "b", 1)
|> map.insert(_, "c", 2)
- |> expect.equal(_, map.from_list([
+ |> should.equal(_, map.from_list([
tuple("a", 0),
tuple("b", 1),
tuple("c", 2),
@@ -92,7 +92,7 @@ pub fn map_values_test() {
]
|> map.from_list
|> map.map_values(_, fn(k, v) { k + v })
- |> expect.equal(_, map.from_list([
+ |> should.equal(_, map.from_list([
tuple(1, 1),
tuple(2, 3),
tuple(3, 5),
@@ -107,7 +107,7 @@ pub fn keys_test() {
]
|> map.from_list
|> map.keys
- |> expect.equal(_, ["a", "b", "c"])
+ |> should.equal(_, ["a", "b", "c"])
}
pub fn values_test() {
@@ -118,7 +118,7 @@ pub fn values_test() {
]
|> map.from_list
|> map.values
- |> expect.equal(_, [0, 1, 2])
+ |> should.equal(_, [0, 1, 2])
}
pub fn take_test() {
@@ -129,7 +129,7 @@ pub fn take_test() {
]
|> map.from_list
|> map.take(_, ["a", "b", "d"])
- |> expect.equal(_, map.from_list([tuple("a", 0), tuple("b", 1)]))
+ |> should.equal(_, map.from_list([tuple("a", 0), tuple("b", 1)]))
}
pub fn drop_test() {
@@ -140,7 +140,7 @@ pub fn drop_test() {
]
|> map.from_list
|> map.drop(_, ["a", "b", "d"])
- |> expect.equal(_, map.from_list([tuple("c", 2)]))
+ |> should.equal(_, map.from_list([tuple("c", 2)]))
}
pub fn merge_test() {
@@ -156,7 +156,7 @@ pub fn merge_test() {
])
map.merge(a, b)
- |> expect.equal(_, map.from_list([
+ |> should.equal(_, map.from_list([
tuple("a", 0),
tuple("b", 1),
tuple("c", 2),
@@ -164,7 +164,7 @@ pub fn merge_test() {
]))
map.merge(b, a)
- |> expect.equal(_, map.from_list([
+ |> should.equal(_, map.from_list([
tuple("a", 2),
tuple("b", 1),
tuple("c", 4),
@@ -181,7 +181,7 @@ pub fn delete_test() {
|> map.from_list
|> map.delete(_, "a")
|> map.delete(_, "d")
- |> expect.equal(_, map.from_list([tuple("b", 1), tuple("c", 2)]))
+ |> should.equal(_, map.from_list([tuple("b", 1), tuple("c", 2)]))
}
pub fn update_test() {
@@ -200,7 +200,7 @@ pub fn update_test() {
dict
|> map.update(_, "a", inc_or_zero)
- |> expect.equal(_, map.from_list([
+ |> should.equal(_, map.from_list([
tuple("a", 1),
tuple("b", 1),
tuple("c", 2),
@@ -208,7 +208,7 @@ pub fn update_test() {
dict
|> map.update(_, "b", inc_or_zero)
- |> expect.equal(_, map.from_list([
+ |> should.equal(_, map.from_list([
tuple("a", 0),
tuple("b", 2),
tuple("c", 2),
@@ -216,7 +216,7 @@ pub fn update_test() {
dict
|> map.update(_, "z", inc_or_zero)
- |> expect.equal(_, map.from_list([
+ |> should.equal(_, map.from_list([
tuple("a", 0),
tuple("b", 1),
tuple("c", 2),
@@ -238,7 +238,7 @@ pub fn fold_test() {
dict
|> map.fold(_, 0, add)
- |> expect.equal(_, 6)
+ |> should.equal(_, 6)
let concat = fn(k, _, acc) {
string.append(acc, k)
@@ -246,9 +246,9 @@ pub fn fold_test() {
dict
|> map.fold(_, "", concat)
- |> expect.equal(_, "abcd")
+ |> should.equal(_, "abcd")
map.from_list([])
|> map.fold(_, 0, add)
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
}
diff --git a/test/gleam/order_test.gleam b/test/gleam/order_test.gleam
index 3d50bf1..d071775 100644
--- a/test/gleam/order_test.gleam
+++ b/test/gleam/order_test.gleam
@@ -1,111 +1,111 @@
-import gleam/expect
+import gleam/should
import gleam/order.{Lt, Eq, Gt}
pub fn reverse_test() {
order.reverse(Lt)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
order.reverse(order.Eq)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.reverse(Gt)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
}
pub fn to_int_test() {
order.to_int(Lt)
- |> expect.equal(_, -1)
+ |> should.equal(_, -1)
order.to_int(order.Eq)
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
order.to_int(Gt)
- |> expect.equal(_, 1)
+ |> should.equal(_, 1)
}
pub fn compare_test() {
order.compare(Lt, Lt)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.compare(Lt, order.Eq)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.compare(Lt, Gt)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.compare(order.Eq, Lt)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
order.compare(order.Eq, order.Eq)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.compare(order.Eq, Gt)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.compare(Gt, Lt)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
order.compare(Gt, order.Eq)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
order.compare(Gt, Gt)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
}
pub fn max_test() {
order.max(Lt, Lt)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.max(Lt, order.Eq)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.max(Lt, Gt)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
order.max(order.Eq, Lt)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.max(order.Eq, order.Eq)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.max(order.Eq, Gt)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
order.max(Gt, Lt)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
order.max(Gt, order.Eq)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
order.max(Gt, Gt)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
}
pub fn min_test() {
order.min(Lt, Lt)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.min(Lt, order.Eq)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.min(Lt, Gt)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.min(order.Eq, Lt)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.min(order.Eq, order.Eq)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.min(order.Eq, Gt)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.min(Gt, Lt)
- |> expect.equal(_, Lt)
+ |> should.equal(_, Lt)
order.min(Gt, order.Eq)
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
order.min(Gt, Gt)
- |> expect.equal(_, Gt)
+ |> should.equal(_, Gt)
}
diff --git a/test/gleam/pair_test.gleam b/test/gleam/pair_test.gleam
index 96b771b..d9a5eb6 100644
--- a/test/gleam/pair_test.gleam
+++ b/test/gleam/pair_test.gleam
@@ -1,30 +1,30 @@
-import gleam/expect
+import gleam/should
import gleam/pair
pub fn first_test() {
tuple(1, 2)
|> pair.first
- |> expect.equal(_, 1)
+ |> should.equal(_, 1)
tuple("abc", [])
|> pair.first
- |> expect.equal(_, "abc")
+ |> should.equal(_, "abc")
}
pub fn second_test() {
tuple(1, 2)
|> pair.second
- |> expect.equal(_, 2)
+ |> should.equal(_, 2)
tuple("abc", [])
|> pair.second
- |> expect.equal(_,[])
+ |> should.equal(_,[])
}
pub fn swap_test() {
tuple(1, "2")
|> pair.swap
- |> expect.equal(_, tuple("2", 1))
+ |> should.equal(_, tuple("2", 1))
}
pub fn map_first_test() {
@@ -32,16 +32,16 @@ pub fn map_first_test() {
a + 1
}
pair.map_first(tuple(1, 2), inc)
- |> expect.equal(_, tuple(2, 2))
+ |> should.equal(_, tuple(2, 2))
pair.map_first(tuple(8,2), inc)
- |> expect.equal(_, tuple(9, 2))
+ |> should.equal(_, tuple(9, 2))
pair.map_first(tuple(0,-2), inc)
- |> expect.equal(_, tuple(1, -2))
+ |> should.equal(_, tuple(1, -2))
pair.map_first(tuple(-10, 20), inc)
- |> expect.equal(_, tuple(-9, 20))
+ |> should.equal(_, tuple(-9, 20))
}
pub fn map_second_test() {
@@ -49,14 +49,14 @@ pub fn map_second_test() {
a - 1
}
pair.map_second(tuple(1, 2), dec)
- |> expect.equal(_, tuple(1, 1))
+ |> should.equal(_, tuple(1, 1))
pair.map_second(tuple(8,2), dec)
- |> expect.equal(_, tuple(8, 1))
+ |> should.equal(_, tuple(8, 1))
pair.map_second(tuple(0,-2), dec)
- |> expect.equal(_, tuple(0, -3))
+ |> should.equal(_, tuple(0, -3))
pair.map_second(tuple(-10, 20), dec)
- |> expect.equal(_, tuple(-10, 19))
+ |> should.equal(_, tuple(-10, 19))
}
diff --git a/test/gleam/result_test.gleam b/test/gleam/result_test.gleam
index 4fab1ad..2d2f344 100644
--- a/test/gleam/result_test.gleam
+++ b/test/gleam/result_test.gleam
@@ -1,88 +1,88 @@
-import gleam/expect
+import gleam/should
import gleam/result
pub fn is_ok_test() {
result.is_ok(Ok(1))
- |> expect.true
+ |> should.be_true
result.is_ok(Error(1))
- |> expect.false
+ |> should.be_false
}
pub fn is_error_test() {
result.is_error(Ok(1))
- |> expect.false
+ |> should.be_false
result.is_error(Error(1))
- |> expect.true
+ |> should.be_true
}
pub fn map_test() {
Ok(1)
|> result.map(_, fn(x) { x + 1 })
- |> expect.equal(_, Ok(2))
+ |> should.equal(_, Ok(2))
Ok(1)
|> result.map(_, fn(_) { "2" })
- |> expect.equal(_, Ok("2"))
+ |> should.equal(_, Ok("2"))
Error(1)
|> result.map(_, fn(x) { x + 1 })
- |> expect.equal(_, Error(1))
+ |> should.equal(_, Error(1))
}
pub fn map_error_test() {
Ok(1)
|> result.map_error(_, fn(x) { x + 1 })
- |> expect.equal(_, Ok(1))
+ |> should.equal(_, Ok(1))
Error(1)
|> result.map_error(_, fn(x) { tuple("ok", x + 1) })
- |> expect.equal(_, Error(tuple("ok", 2)))
+ |> should.equal(_, Error(tuple("ok", 2)))
}
pub fn flatten_test() {
Ok(Ok(1))
|> result.flatten
- |> expect.equal(_, Ok(1))
+ |> should.equal(_, Ok(1))
Ok(Error(1))
|> result.flatten
- |> expect.equal(_, Error(1))
+ |> should.equal(_, Error(1))
Error(1)
|> result.flatten
- |> expect.equal(_, Error(1))
+ |> should.equal(_, Error(1))
Error(Error(1))
|> result.flatten
- |> expect.equal(_, Error(Error(1)))
+ |> should.equal(_, Error(Error(1)))
}
pub fn then_test() {
Error(1)
|> result.then(_, fn(x) { Ok(x + 1) })
- |> expect.equal(_, Error(1))
+ |> should.equal(_, Error(1))
Ok(1)
|> result.then(_, fn(x) { Ok(x + 1) })
- |> expect.equal(_, Ok(2))
+ |> should.equal(_, Ok(2))
Ok(1)
|> result.then(_, fn(_) { Ok("type change") })
- |> expect.equal(_, Ok("type change"))
+ |> should.equal(_, Ok("type change"))
Ok(1)
|> result.then(_, fn(_) { Error(1) })
- |> expect.equal(_, Error(1))
+ |> should.equal(_, Error(1))
}
pub fn unwrap_test() {
Ok(1)
|> result.unwrap(_, 50)
- |> expect.equal(_, 1)
+ |> should.equal(_, 1)
Error("nope")
|> result.unwrap(_, 50)
- |> expect.equal(_, 50)
+ |> should.equal(_, 50)
}
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam
index 3f278f6..ae8a0e9 100644
--- a/test/gleam/string_test.gleam
+++ b/test/gleam/string_test.gleam
@@ -1,70 +1,70 @@
import gleam/string
-import gleam/expect
+import gleam/should
import gleam/order
pub fn length_test() {
string.length("ß↑e̊")
- |> expect.equal(_, 3)
+ |> should.equal(_, 3)
string.length("Gleam")
- |> expect.equal(_, 5)
+ |> should.equal(_, 5)
string.length("")
- |> expect.equal(_, 0)
+ |> should.equal(_, 0)
}
pub fn lowercase_test() {
string.lowercase("Gleam")
- |> expect.equal(_, "gleam")
+ |> should.equal(_, "gleam")
}
pub fn uppercase_test() {
string.uppercase("Gleam")
- |> expect.equal(_, "GLEAM")
+ |> should.equal(_, "GLEAM")
}
pub fn reverse_test() {
string.reverse("Gleam")
- |> expect.equal(_, "maelG")
+ |> should.equal(_, "maelG")
}
pub fn split_test() {
"Gleam,Erlang,Elixir"
|> string.split(_, ",")
- |> expect.equal(_, ["Gleam", "Erlang", "Elixir"])
+ |> should.equal(_, ["Gleam", "Erlang", "Elixir"])
"Gleam, Erlang,Elixir"
|> string.split(_, ", ")
- |> expect.equal(_, ["Gleam", "Erlang,Elixir"])
+ |> should.equal(_, ["Gleam", "Erlang,Elixir"])
}
pub fn replace_test() {
"Gleam,Erlang,Elixir"
|> string.replace(_, ",", "++")
- |> expect.equal(_, "Gleam++Erlang++Elixir")
+ |> should.equal(_, "Gleam++Erlang++Elixir")
}
pub fn append_test() {
"Test"
|> string.append(_, " Me")
- |> expect.equal(_, "Test Me")
+ |> should.equal(_, "Test Me")
}
pub fn compare_test() {
string.compare("", "")
- |> expect.equal(_, order.Eq)
+ |> should.equal(_, order.Eq)
string.compare("a", "")
- |> expect.equal(_, order.Gt)
+ |> should.equal(_, order.Gt)
string.compare("a", "A")
- |> expect.equal(_, order.Gt)
+ |> should.equal(_, order.Gt)
string.compare("A", "B")
- |> expect.equal(_, order.Lt)
+ |> should.equal(_, order.Lt)
string.compare("t", "ABC")
- |> expect.equal(_, order.Gt)
+ |> should.equal(_, order.Gt)
}
pub fn concat_test() {
@@ -72,7 +72,7 @@ pub fn concat_test() {
"Hello", ", ", "world!",
]
|> string.concat
- |> expect.equal(_, "Hello, world!")
+ |> should.equal(_, "Hello, world!")
}
pub fn join_test() {
@@ -80,11 +80,11 @@ pub fn join_test() {
"Hello", "world!",
]
|> string.join(_, with: ", ")
- |> expect.equal(_, "Hello, world!")
+ |> should.equal(_, "Hello, world!")
[
"Hello", "world!",
]
|> string.join(_, with: "-")
- |> expect.equal(_, "Hello-world!")
+ |> should.equal(_, "Hello-world!")
}