pub fn check_flag<T: 'static>(
    want: Option<ExpectedFlag<'static, T>>,
    got: Option<&gflags::registry::Flag>,
) {
    if want.is_none() && got.is_none() {
        return;
    }

    assert_eq!(
        want.is_none() && got.is_some(),
        false,
        "Unexpected flag with name --{}",
        got.unwrap().name
    );

    assert_eq!(
        want.is_some() && got.is_none(),
        false,
        "Failed to find flag with name --{}",
        want.unwrap().name
    );

    let want = want.unwrap();
    let got: &gflags::registry::Flag = got.unwrap();

    assert_eq!(want.doc, got.doc);

    assert_eq!(want.placeholder, got.placeholder);

    // Technically this type checking isn't necessary, because if the type
    // parameter used to construct `ExpectedFlag` doesn't match the type of
    // the generated flag it's a compile time error and the test won't compile
    // I'm keeping the code here as an example of how to do this.
    let typed_flag: gflags::Flag<T> = gflags::Flag::null();
    assert!(is_same_type(&typed_flag, want.generated_flag));
}
/// Performs various assertions to confirm that the flag in `got` matches
/// the expectations in `want`.
Performs various assertions to confirm that the flag in `got` matches
the expectations in `want`.
Performs various assertions to confirm that the flag in ` got ` matches the expectations in ` want ` .
pub fn check_flag<T: 'static>(
    want: Option<ExpectedFlag<'static, T>>,
    got: Option<&gflags::registry::Flag>,
) {
    if want.is_none() && got.is_none() {
        return;
    }
    assert_eq!(
        want.is_none() && got.is_some(),
        false,
        "Unexpected flag with name --{}",
        got.unwrap().name
    );
    assert_eq!(
        want.is_some() && got.is_none(),
        false,
        "Failed to find flag with name --{}",
        want.unwrap().name
    );
    let want = want.unwrap();
    let got: &gflags::registry::Flag = got.unwrap();
    assert_eq!(want.doc, got.doc);
    assert_eq!(want.placeholder, got.placeholder);
    // Technically this type checking isn't necessary, because if the type
    // parameter used to construct `ExpectedFlag` doesn't match the type of
    // the generated flag it's a compile time error and the test won't compile
    // I'm keeping the code here as an example of how to do this.
    let typed_flag: gflags::Flag<T> = gflags::Flag::null();
    assert!(is_same_type(&typed_flag, want.generated_flag));
}
pub fn check_flag < T : ' static > ( want : Option < ExpectedFlag < ' static , T > > , got : Option < & gflags :: registry :: Flag > , ) { if want . is_none ( ) && got . is_none ( ) { return ; } assert_eq ! ( want is_none ( ) got is_some ( ) false " " got unwrap ( ) name ) ; assert_eq ! ( want is_some ( ) got is_none ( ) false " " want unwrap ( ) name ) ; let want = want . unwrap ( ) ; let got : & gflags :: registry :: Flag = got . unwrap ( ) ; assert_eq ! ( want doc got doc ) ; assert_eq ! ( want placeholder got placeholder ) ; // Technically this type checking isn't necessary, because if the type // parameter used to construct `ExpectedFlag` doesn't match the type of // the generated flag it's a compile time error and the test won't compile // I'm keeping the code here as an example of how to do this. let typed_flag : gflags :: Flag < T > = gflags :: Flag :: null ( ) ; assert ! ( is_same_type ( typed_flag want generated_flag ) ) ; }
Performs various assertions to confirm that the flag in `got` matches
the expectations in `want`.
Performs various assertions to confirm that the flag in ` got ` matches the expectations in ` want ` .
want
Option<ExpectedFlag<'static, T>>
got
Option<&gflags::registry::Flag>
want
Option<ExpectedFlag<'static, T>>
got
Option<&gflags::registry::Flag>