Skip to content

Commit

Permalink
test: move unit test for write fn
Browse files Browse the repository at this point in the history
  • Loading branch information
u8slvn committed Feb 9, 2024
1 parent ccb6a23 commit fc3b9c1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ jobs:
- name: Publish Coverage
uses: codecov/codecov-action@v1
files: coverage.lcov, coverage.xml
with:
files: coverage.lcov, coverage.xml
if: |
matrix.os == 'ubuntu' &&
matrix.python-version == '3.10'
31 changes: 31 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,35 @@ mod tests {
test_process_word_with_utf8_word: ("déjà", "[b]dé[/b]jà"),
test_process_word_with_word: ("Hello", "[b]He[/b]llo"),
}

#[test]
fn test_write_text_as_bionic_reading() {
let text = concat!(
"Now that we know who you are, I know who I am. I'm not ",
"a mistake! It all makes sense! In a comic, you know how you can tell ",
"who the arch-villain's going to be? He's the exact opposite of the ",
"hero. And most times they're friends, like you and me! I should've ",
"known way back when... You know why, David? Because of the kids. They ",
"called me Mr Glass."
);
let affix = "**";
let postfix = "**";

let result = write(text, affix, postfix);

let expected = concat!(
"**N**ow **th**at **w**e **kn**ow **w**ho **y**ou **a**re, **I** ",
"**kn**ow **w**ho **I** **a**m. **I**'**m** **n**ot **a** ",
"**mis**take! **I**t **a**ll **ma**kes **se**nse! **I**n **a** ",
"**co**mic, **y**ou **kn**ow **h**ow **y**ou **c**an **te**ll **w**ho ",
"**t**he **ar**ch-**vil**lain'**s** **go**ing **t**o **b**e? ",
"**H**e'**s** **t**he **ex**act **oppo**site **o**f **t**he **he**ro. ",
"**A**nd **mo**st **ti**mes **th**ey'**r**e **fri**ends, **li**ke ",
"**y**ou **a**nd **m**e! **I** **sho**uld'**v**e **kn**own **w**ay ",
"**ba**ck **wh**en... **Y**ou **kn**ow **w**hy, **Da**vid? ",
"**Bec**ause **o**f **t**he **ki**ds. **Th**ey **cal**led **m**e ",
"**M**r **Gl**ass."
);
assert_eq!(expected, result.unwrap());
}
}

0 comments on commit fc3b9c1

Please sign in to comment.