Skip to content

Commit

Permalink
test(list): add test for to_array
Browse files Browse the repository at this point in the history
  • Loading branch information
Lampese authored and bobzhang committed Mar 11, 2024
1 parent c830f0c commit 1ed3347
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions list/list.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ pub fn to_array[T : Default](self : List[T]) -> Array[T] {
return arr
}

test "to array" {
let list = List::[1, 2, 3, 4, 5]
let array = to_array(list)
@assertion.assert_eq(array, [1, 2, 3, 4, 5])?
}

/// Filter the list.
///
/// # Example
Expand Down
3 changes: 2 additions & 1 deletion list/moon.pkg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"import": [
{ "path": "moonbitlang/core/assertion", "alias": "assertion" }
{ "path": "moonbitlang/core/assertion", "alias": "assertion" },
{ "path": "moonbitlang/core/array", "alias": "array" }
]
}

0 comments on commit 1ed3347

Please sign in to comment.