From 900619be86f9f152cd278e7ad29befae2fc5634e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 24 Jan 2022 09:45:14 -0600 Subject: [PATCH] docs: Fix typo in example config Fixes #404 --- README.md | 2 +- src/config.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f73a83..e9e819b 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ teh = "teh" For cases like localized content, you can disable spell checking of file contents while still checking the file name: ```toml [type.po] -extend-globs = ["*.po"] +extend-glob = ["*.po"] check-file = false ``` (run `typos --type-list` to see configured file types) diff --git a/src/config.rs b/src/config.rs index 9ef790d..7fd85fe 100644 --- a/src/config.rs +++ b/src/config.rs @@ -563,4 +563,26 @@ mod test { let expected: Vec = vec!["*.foo".into(), "*.bar".into()]; assert_eq!(actual.extend_glob, expected); } + + #[test] + fn parse_extend_globs() { + let input = r#"[type.po] +extend-glob = ["*.po"] +"#; + let mut expected = Config::default(); + expected.type_.patterns.insert( + "po".into(), + GlobEngineConfig { + extend_glob: vec!["*.po".into()], + engine: EngineConfig { + tokenizer: Some(TokenizerConfig::default()), + dict: Some(DictConfig::default()), + ..Default::default() + }, + ..Default::default() + }, + ); + let actual = Config::from_toml(input).unwrap(); + assert_eq!(actual, expected); + } }