From f87b041e27fbe1523486941528849086d85a51e1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 8 Jun 2020 09:09:44 +0200 Subject: [PATCH] test(hostid) add a test for hostid (#1533) --- tests/by-util/test_hostid.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_hostid.rs b/tests/by-util/test_hostid.rs index 651491045..17aad4aff 100644 --- a/tests/by-util/test_hostid.rs +++ b/tests/by-util/test_hostid.rs @@ -1 +1,13 @@ -// ToDO: add tests +use crate::common::util::*; +extern crate regex; +use self::regex::Regex; + +#[test] +fn test_normal() { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.run(); + + assert!(result.success); + let re = Regex::new(r"^[0-9a-f]{8}").unwrap(); + assert!(re.is_match(&result.stdout.trim())); +}