diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 438386f..331d175 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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' diff --git a/src/lib.rs b/src/lib.rs index 7389063..31dbb7e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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()); + } }