MCPcopy Create free account
hub / github.com/bootc-dev/bootc / test_kargs_find_dash_hyphen

Function test_kargs_find_dash_hyphen

crates/kernel_cmdline/src/bytes.rs:784–802  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

782
783 #[test]
784 fn test_kargs_find_dash_hyphen() {
785 let kargs = Cmdline::from(b"a-b=1 a_b=2".as_slice());
786 // find should find the first one, which is a-b=1
787 let p = kargs.find("a_b").unwrap();
788 assert_eq!(p.key.0, b"a-b");
789 assert_eq!(p.value.unwrap(), b"1");
790 let p = kargs.find("a-b").unwrap();
791 assert_eq!(p.key.0, b"a-b");
792 assert_eq!(p.value.unwrap(), b"1");
793
794 let kargs = Cmdline::from(b"a_b=2 a-b=1".as_slice());
795 // find should find the first one, which is a_b=2
796 let p = kargs.find("a_b").unwrap();
797 assert_eq!(p.key.0, b"a_b");
798 assert_eq!(p.value.unwrap(), b"2");
799 let p = kargs.find("a-b").unwrap();
800 assert_eq!(p.key.0, b"a_b");
801 assert_eq!(p.value.unwrap(), b"2");
802 }
803
804 #[test]
805 fn test_kargs_extra_whitespace() {

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected