mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-22 23:52:12 -05:00
test: Ensure extend-words also works
This was fixed in the previous commit when dealing with deny_unknown_fields. Fixes #407
This commit is contained in:
parent
55114b3777
commit
9b6b0dee5c
1 changed files with 33 additions and 0 deletions
|
@ -594,4 +594,37 @@ check-file = true
|
||||||
let actual = Config::from_toml(input).unwrap();
|
let actual = Config::from_toml(input).unwrap();
|
||||||
assert_eq!(actual, expected);
|
assert_eq!(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_extend_words() {
|
||||||
|
let input = r#"[type.shaders]
|
||||||
|
extend-glob = [
|
||||||
|
'*.shader',
|
||||||
|
'*.cginc',
|
||||||
|
]
|
||||||
|
|
||||||
|
[type.shaders.extend-words]
|
||||||
|
inout = "inout"
|
||||||
|
"#;
|
||||||
|
let mut expected = Config::default();
|
||||||
|
expected.type_.patterns.insert(
|
||||||
|
"shaders".into(),
|
||||||
|
GlobEngineConfig {
|
||||||
|
extend_glob: vec!["*.shader".into(), "*.cginc".into()],
|
||||||
|
engine: EngineConfig {
|
||||||
|
tokenizer: Some(TokenizerConfig::default()),
|
||||||
|
dict: Some(DictConfig {
|
||||||
|
extend_words: maplit::hashmap! {
|
||||||
|
"inout".into() => "inout".into(),
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
let actual = Config::from_toml(input).unwrap();
|
||||||
|
assert_eq!(actual, expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue