From f25b8789962157f7fa2af55b139a75e2ee1a09af Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Fri, 6 Jun 2025 22:33:30 +0200 Subject: grit: Allow if's to be recursive Not often used in grit files, if at all, but needed when we want to add support for expanding grit-part in grit structure. --- server/common/src/tests.rs | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'server/common/src/tests.rs') diff --git a/server/common/src/tests.rs b/server/common/src/tests.rs index fc4d7aa..f336f67 100644 --- a/server/common/src/tests.rs +++ b/server/common/src/tests.rs @@ -322,11 +322,13 @@ async fn test_grit_parse_base() { grit::IfOutput::If { expr: "not pp_if('zawgyi_encoding')".to_string(), output: vec![ - grit::Output { - filename: "values-my-rZG/strings.xml".to_string(), - output_type: "android".to_string(), - lang: "my-ZG".to_string(), - }, + grit::IfOutput::Output( + grit::Output { + filename: "values-my-rZG/strings.xml".to_string(), + output_type: "android".to_string(), + lang: "my-ZG".to_string(), + }, + ), ], }, grit::IfOutput::Output( @@ -349,23 +351,29 @@ async fn test_grit_parse_base() { grit::IfFile::If { expr: "pp_if('zawgyi_encoding')".to_string(), file: vec![ - grit::File { - path: "translations/base_my-Zawgyi.xlf".to_string(), - lang: "my".to_string(), - }, + grit::IfFile::File( + grit::File { + path: "translations/base_my-Zawgyi.xlf".to_string(), + lang: "my".to_string(), + }, + ), ], }, grit::IfFile::If { expr: "not pp_if('zawgyi_encoding')".to_string(), file: vec![ - grit::File { - path: "translations/base_my.xlf".to_string(), - lang: "my".to_string(), - }, - grit::File { - path: "translations/base_my-Zawgyi.xlf".to_string(), - lang: "my-ZG".to_string(), - }, + grit::IfFile::File( + grit::File { + path: "translations/base_my.xlf".to_string(), + lang: "my".to_string(), + }, + ), + grit::IfFile::File( + grit::File { + path: "translations/base_my-Zawgyi.xlf".to_string(), + lang: "my-ZG".to_string(), + }, + ), ], }, grit::IfFile::File( @@ -385,7 +393,7 @@ async fn test_grit_parse_base() { grit::IfMessagePart::If { expr: "pp_ifdef('include_extra')".to_string(), message: vec![ - grit::MessagePart::Part( + grit::IfMessagePart::Part( grit::PartRef { file: "extra.grdp".to_string(), }, -- cgit v1.2.3-70-g09d2