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

Function test_kargs_simple

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

Source from the content-addressed store, hash-verified

707
708 #[test]
709 fn test_kargs_simple() {
710 // example taken lovingly from:
711 // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/params.c?id=89748acdf226fd1a8775ff6fa2703f8412b286c8#n160
712 let kargs = Cmdline::from(b"foo=bar,bar2 baz=fuz wiz".as_slice());
713 let mut iter = kargs.iter();
714
715 assert_eq!(iter.next(), Some(param("foo=bar,bar2")));
716 assert_eq!(iter.next(), Some(param("baz=fuz")));
717 assert_eq!(iter.next(), Some(param("wiz")));
718 assert_eq!(iter.next(), None);
719
720 // Test the find API
721 assert_eq!(kargs.find("foo").unwrap().value.unwrap(), b"bar,bar2");
722 assert!(kargs.find("nothing").is_none());
723 }
724
725 #[test]
726 fn test_cmdline_default() {

Callers

nothing calls this directly

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected