Replies: 1 comment 1 reply
-
This is a form of the ideal unit test code what I am thinking. Modified from https://github.com/lens0021/test-chamber/blob/e4b7f7c511a12da5fc795b8f9c08696a60273f17/stdlib-examples/array_contains.ab import * from "std/array"
import { assert_true, assert_false } from "std/test"
#[test]
pub failable fun test_array_contains() {
const array = [1, 2, 3]
assert_true(array_contains(array, 2), "array_contains should return true when given an item")?
assert_false(array_contains(array, 0), "array_contains should return false when given a non existing item")?
}
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This repository contains both tests for rust and tests for amber. This discussion is for the latter.
Motivation 1. As an amber user, I want to test the amber scripts I write.
Motivation 2. As (a kind of) a maintainer of Amber, I want to
Output
comments show the all output on the top altogether, the test result does now tell why it should be, etc.assert*
functions.And the following is some questions:
pub
functions?panic!()
? Or setting an environment value?#[cfg(test)]
will be introduced.Beta Was this translation helpful? Give feedback.
All reactions