()
| 834 | |
| 835 | #[test] |
| 836 | fn test_require_value_of() { |
| 837 | let kargs = Cmdline::from(b"foo=bar baz=qux switch".as_slice()); |
| 838 | |
| 839 | // Test existing key with value |
| 840 | assert_eq!(kargs.require_value_of("foo").unwrap(), b"bar"); |
| 841 | assert_eq!(kargs.require_value_of("baz").unwrap(), b"qux"); |
| 842 | |
| 843 | // Test key without value should fail |
| 844 | let err = kargs.require_value_of("switch").unwrap_err(); |
| 845 | assert!( |
| 846 | err.to_string() |
| 847 | .contains("Failed to find kernel argument 'switch'") |
| 848 | ); |
| 849 | |
| 850 | // Test non-existent key should fail |
| 851 | let err = kargs.require_value_of("missing").unwrap_err(); |
| 852 | assert!( |
| 853 | err.to_string() |
| 854 | .contains("Failed to find kernel argument 'missing'") |
| 855 | ); |
| 856 | |
| 857 | // Test dash/underscore equivalence |
| 858 | let kargs = Cmdline::from(b"dash-key=value1 under_key=value2".as_slice()); |
| 859 | assert_eq!(kargs.require_value_of("dash_key").unwrap(), b"value1"); |
| 860 | assert_eq!(kargs.require_value_of("under-key").unwrap(), b"value2"); |
| 861 | } |
| 862 | |
| 863 | #[test] |
| 864 | fn test_find_all() { |
nothing calls this directly
no test coverage detected