Skip to content

Commit

Permalink
fixed the flaky slugification testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Sep 10, 2023
1 parent a3ef475 commit 9a2b0e3
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions server/main-api/src/search/search_executor/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,24 @@ mod tokenizer_tests {
}

#[test]
fn test_slugify() {
fn test_slugify_identical() {
// identical
assert_eq!(&slugify(""), "");
assert_eq!(&slugify("a"), "a");
assert_eq!(&slugify("1234567890"), "1234567890");
assert_eq!(&slugify("äöüßa."), "äöüßa.");
}

#[test]
fn test_slugify() {
// to-lower
assert_eq!(&slugify("B"), "b");
assert_eq!(&slugify("-B"), "b");
assert_eq!(&slugify("-B"), "b");
assert_eq!(&slugify("+#.a.-21"), "a-21");
assert_eq!(&slugify("a--21"), "a-21");
assert_eq!(&slugify("aA"), "aa");
// leading/tailing "-" get stripped
assert_eq!(&slugify("-B-"), "b");
// no double dashes
assert_eq!(&slugify("a--21"), "a-21");
assert_eq!(&slugify("a**21"), "a-21");
}

#[test]
Expand Down

0 comments on commit 9a2b0e3

Please sign in to comment.