fn validate_valid_time_spec_validation() {
        let float_rejected = "1.4m";
        assert!(valid_time_spec(float_rejected.into()).is_err());

        let negative_rejected = "-1m";
        assert!(valid_time_spec(negative_rejected.into()).is_err());

        let only_number_rejected = "1";
        assert!(valid_time_spec(only_number_rejected.into()).is_err());

        let only_measurement_rejected = "m";
        assert!(valid_time_spec(only_measurement_rejected.into()).is_err());

        for accepted_measurement in &["s", "m", "h", "d", "S", "M", "H", "D"] {
            // all upper/lowercase should be good
            assert!(valid_time_spec(format!("1{}", *accepted_measurement)).is_ok());
        }

        let leading_space_rejected = " 14m";
        assert!(valid_time_spec(leading_space_rejected.into()).is_err());

        let trailing_space_rejected = "14m ";
        assert!(valid_time_spec(trailing_space_rejected.into()).is_err());

        let space_between_rejected = "1 4m";
        assert!(valid_time_spec(space_between_rejected.into()).is_err());
    }
/// sanity checks that valid_time_spec correctly checks and rejects a given string
///
/// instead of having a bunch of single tests here, they're all quick and are mostly checking
/// that i didn't hose up the regex.  Going to consolidate them into a single test
sanity checks that valid_time_spec correctly checks and rejects a given string
instead of having a bunch of single tests here, they're all quick and are mostly checking
that i didn't hose up the regex.  Going to consolidate them into a single test
sanity checks that valid_time_spec correctly checks and rejects a given string instead of having a bunch of single tests here they ' re all quick and are mostly checking that i didn ' t hose up the regex . Going to consolidate them into a single test
fn validate_valid_time_spec_validation() {
        let float_rejected = "1.4m";
        assert!(valid_time_spec(float_rejected.into()).is_err());
        let negative_rejected = "-1m";
        assert!(valid_time_spec(negative_rejected.into()).is_err());
        let only_number_rejected = "1";
        assert!(valid_time_spec(only_number_rejected.into()).is_err());
        let only_measurement_rejected = "m";
        assert!(valid_time_spec(only_measurement_rejected.into()).is_err());
        for accepted_measurement in &["s", "m", "h", "d", "S", "M", "H", "D"] {
            // all upper/lowercase should be good
            assert!(valid_time_spec(format!("1{}", *accepted_measurement)).is_ok());
        }
        let leading_space_rejected = " 14m";
        assert!(valid_time_spec(leading_space_rejected.into()).is_err());
        let trailing_space_rejected = "14m ";
        assert!(valid_time_spec(trailing_space_rejected.into()).is_err());
        let space_between_rejected = "1 4m";
        assert!(valid_time_spec(space_between_rejected.into()).is_err());
    }
fn validate_valid_time_spec_validation ( ) { let float_rejected = " " ; assert ! ( valid_time_spec ( float_rejected into ( ) ) is_err ( ) ) ; let negative_rejected = " " ; assert ! ( valid_time_spec ( negative_rejected into ( ) ) is_err ( ) ) ; let only_number_rejected = " " ; assert ! ( valid_time_spec ( only_number_rejected into ( ) ) is_err ( ) ) ; let only_measurement_rejected = " " ; assert ! ( valid_time_spec ( only_measurement_rejected into ( ) ) is_err ( ) ) ; for accepted_measurement in & [ " " , " " , " " , " " , " " , " " , " " , " " ] { // all upper/lowercase should be good assert ! ( valid_time_spec ( format ( " " accepted_measurement ) ) is_ok ( ) ) ; } let leading_space_rejected = " " ; assert ! ( valid_time_spec ( leading_space_rejected into ( ) ) is_err ( ) ) ; let trailing_space_rejected = " " ; assert ! ( valid_time_spec ( trailing_space_rejected into ( ) ) is_err ( ) ) ; let space_between_rejected = " " ; assert ! ( valid_time_spec ( space_between_rejected into ( ) ) is_err ( ) ) ; }
sanity checks that valid_time_spec correctly checks and rejects a given string
instead of having a bunch of single tests here, they're all quick and are mostly checking
that i didn't hose up the regex.
sanity checks that valid_time_spec correctly checks and rejects a given string instead of having a bunch of single tests here they ' re all quick and are mostly checking that i didn ' t hose up the regex .