diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-01-28 19:40:49 +0000 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2019-01-28 19:40:49 +0000 |
commit | 52df93249f27ae803bada0451d7380bc3d596007 (patch) | |
tree | cbaefc826acc68514d2c16e93666ec639f7e1c5b /tests/lib.rs | |
parent | 5d7bb087707915a78149da7492cccd772db2657e (diff) | |
download | nitrokey-rs-52df93249f27ae803bada0451d7380bc3d596007.tar.gz nitrokey-rs-52df93249f27ae803bada0451d7380bc3d596007.tar.bz2 |
Add unwrap_ok macro to replace unwrap in unit tests
The unwrap error message is not very useful. This patch adds the
unwrap_ok macro that is basically the same as unwrap but prints a more
readable error message.
Diffstat (limited to 'tests/lib.rs')
-rw-r--r-- | tests/lib.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/lib.rs b/tests/lib.rs index 697024d..8ab75f6 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1,9 +1,11 @@ // Copyright (C) 2019 Robin Krahl <robin.krahl@ireas.org> // SPDX-License-Identifier: MIT +mod util; + #[test] fn get_library_version() { - let version = nitrokey::get_library_version().unwrap(); + let version = unwrap_ok!(nitrokey::get_library_version()); assert!(version.git.is_empty() || version.git.starts_with("v")); assert!(version.major > 0); |