Mercurial > hg
changeset 50980:d7b2701f17fa
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.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 08 Aug 2023 14:14:00 +0200 |
parents | 4c5f6e95df84 |
children | 58390f59826f |
files | rust/hg-core/src/config/mod.rs |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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); + } }