From 9b6b0dee5c73690418c5f761cb7d9d6f5ec68433 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 24 Jan 2022 11:59:58 -0600 Subject: [PATCH] test: Ensure extend-words also works This was fixed in the previous commit when dealing with deny_unknown_fields. Fixes #407 --- src/config.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/config.rs b/src/config.rs index 4fbcdbd..4f8f58a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -594,4 +594,37 @@ check-file = true let actual = Config::from_toml(input).unwrap(); 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); + } }