# HG changeset patch # User Raphaël Gomès # Date 1691496840 -7200 # Node ID d7b2701f17facce6a5dc19daf90b288fe0387b42 # Parent 4c5f6e95df84372e20654b8622910228ac1495a5 rust-config: demonstrate a bug when falling back to non-trivial default values The default value (when the user hasn't configured anything) is not run through the value parser, causing a programming error to happen because of type mismatch. This will be fixed in the next commit. diff -r 4c5f6e95df84 -r d7b2701f17fa rust/hg-core/src/config/mod.rs --- a/rust/hg-core/src/config/mod.rs Fri Aug 18 14:34:29 2023 +0200 +++ b/rust/hg-core/src/config/mod.rs Tue Aug 08 14:14:00 2023 +0200 @@ -773,4 +773,13 @@ assert!(config.get_u32(b"section2", b"not-count").is_err()); assert!(config.get_byte_size(b"section2", b"not-size").is_err()); } + + #[test] + fn test_default_parse() { + let config = Config::load_from_explicit_sources(vec![]) + .expect("expected valid config"); + let ret = config.get_byte_size(b"cmdserver", b"max-log-size"); + // FIXME should be `is_ok` + assert!(ret.is_err(), "{:?}", ret); + } }