Skip to content

Commit

Permalink
Add more tests for multiple prefixes & suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Jan 2, 2023
1 parent 9b79a29 commit 1e7d5fd
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 46 deletions.
1 change: 0 additions & 1 deletion crates/zspell/src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ impl Dictionary {
/// Return type is vector of `(new_word, rule, second_rule)` where
/// `second_rule` is available if both a prefix and a suffix were applied
// PERF: benchmark taking a vec reference instead of returning
// TODO: include morph data for generated words
fn create_affixed_words(&mut self, stem: &str, flags: &[u32], _morph: &[MorphInfo]) {
let mut prefix_rules = Vec::new();
let mut suffix_rules = Vec::new();
Expand Down
43 changes: 0 additions & 43 deletions crates/zspell/tests/files/1_pfxsfx.test

This file was deleted.

File renamed without changes.
70 changes: 70 additions & 0 deletions crates/zspell/tests/managed/1_pfxsfx.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
%% Test basic affix, including:
%% - Only prefix
%% - Only suffix
%% - Stripping characters
%% - Patterns
%% - Combined prefix and suffix
%% - Noncombining prefix and suffix

==== afx_str ====
SET UTF-8

PFX A Y 1
PFX A 0 aa .

SFX B Y 3
SFX B 0 bb .
SFX B y cc y
SFX B 0 dd [^y]

PFX C N 2
PFX C yy ee .
PFX C 0 ff .


==== dic_str ====
4
xxx/A
yyy/B
zzz/AB
yyyy/AC


==== check_valid ====
xxx
yyy
zzz
yyyy
aaxxx
yyybb
yycc
aazzz
zzzbb
zzzdd
aazzzbb
aazzzdd
aayyyy
eeyy
ffyyyy


==== check_invalid ====
%% Nothing to see here
nothing

==== wordlist ====
xxx
yyy
zzz
yyyy
aaxxx
yyybb
yycc
aazzz
zzzbb
zzzdd
aazzzbb
aazzzdd
aayyyy
eeyy
ffyyyy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Verify our nosuggest flag works
%% Verify our nosuggest anf forbid flags works

==== afx_str ====
NOSUGGEST !
Expand Down
2 changes: 1 addition & 1 deletion crates/zspell/util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl TestManager {
let mut fpath = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
fpath.pop();
fpath.push("tests");
fpath.push("files");
fpath.push("managed");
fpath.push(fname);

let f_content = fs::read_to_string(&fpath)
Expand Down

0 comments on commit 1e7d5fd

Please sign in to comment.