From d24b1e5c5951ddb9c9167c1586883c3091bfca03 Mon Sep 17 00:00:00 2001
From: Fuad Ismail <fuad1502@gmail.com>
Date: Thu, 12 Dec 2024 13:05:57 +0700
Subject: [PATCH] tests/dmesg: add invalid level/facility argument test.

---
 tests/by-util/test_dmesg.rs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/by-util/test_dmesg.rs b/tests/by-util/test_dmesg.rs
index a75f4a7..13614c6 100644
--- a/tests/by-util/test_dmesg.rs
+++ b/tests/by-util/test_dmesg.rs
@@ -128,6 +128,24 @@ fn test_filter_levels() {
     }
 }
 
+#[test]
+fn test_invalid_facility_argument() {
+    new_ucmd!()
+        .arg("--facility=definitely-invalid")
+        .fails()
+        .code_is(1)
+        .stderr_only("dmesg: unknown facility 'definitely-invalid'\n");
+}
+
+#[test]
+fn test_invalid_level_argument() {
+    new_ucmd!()
+        .arg("--level=definitely-invalid")
+        .fails()
+        .code_is(1)
+        .stderr_only("dmesg: unknown level 'definitely-invalid'\n");
+}
+
 #[test]
 fn test_filter_multiple() {
     let mut cmd = new_ucmd!();