官术网_书友最值得收藏!

First unit test

The following is our very first unit test:

// first_unit_test.rs

#[test]
fn basic_test() {
assert!(true);
}

A unit test is written as a function and is marked with a #[test] attribute. There's nothing complex in the preceding basic_test function. We have a basic assert! call passing in true. For better organization, you may also create a child module called tests (by convention) and put all related test code inside it.

主站蜘蛛池模板: 久治县| 武邑县| 天祝| 城固县| 宣汉县| 通化县| 陇川县| 内丘县| 阿坝县| 卢龙县| 新沂市| 青川县| 聂荣县| 大丰市| 德江县| 图们市| 清远市| 陕西省| 东乌珠穆沁旗| 阿瓦提县| 罗平县| 巨鹿县| 收藏| 大石桥市| 平凉市| 康乐县| 德昌县| 金沙县| 漳浦县| 枝江市| 汝阳县| 瑞昌市| 乾安县| 灵台县| 湖口县| 嘉鱼县| 双鸭山市| 宜春市| 元氏县| 乐至县| 高碑店市|