Skip to content

Commit 1e951e8

Browse files
committed
test(gencat): add tests for gencat sets and messages with quotes
1 parent 19143be commit 1e951e8

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

i18n/tests/gencat/mod.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,29 @@ fn gencat_sets_and_messagess() {
7676
Vec::new(),
7777
);
7878
}
79+
80+
#[test]
81+
fn gencat_sets_and_messagess_with_quote() {
82+
let cargo_manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
83+
let msg_file = cargo_manifest_dir.join("tests/gencat/sets_and_messages_with_quotes.msg");
84+
85+
#[cfg(not(target_os = "macos"))]
86+
let expected_cat_file =
87+
cargo_manifest_dir.join("tests/gencat/sets_and_messages_with_quotes_gnu_catfile.cat");
88+
89+
#[cfg(target_os = "macos")]
90+
let expected_cat_file =
91+
cargo_manifest_dir.join("tests/gencat/sets_and_messages_with_quotes_osx_catfile.cat");
92+
93+
let mut expected_output: Vec<u8> = Vec::new();
94+
File::open(&expected_cat_file)
95+
.unwrap()
96+
.read_to_end(&mut expected_output)
97+
.unwrap();
98+
99+
gencat_test(
100+
&["-", msg_file.to_str().unwrap()],
101+
expected_output,
102+
Vec::new(),
103+
);
104+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$quote "
2+
3+
$quote -
4+
5+
$ btw this is a comment, the first quote should be ignored (as there can be only one quote per message file)
6+
7+
$set 1
8+
1 - This is first message-
9+
2 -This is second message-
10+
11+
$set 2
12+
1 -This is third message-
13+
2 This is fourth message
202 Bytes
Binary file not shown.
270 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)