Skip to content

Commit

Permalink
Add load unicode async test
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaluza committed Aug 20, 2024
1 parent 06cecc2 commit 29f83e2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ fn get_text_from_first_page(doc: &Document) -> String {
extracted_text
}

#[cfg(not(feature = "async"))]
#[test]
fn unicode_can_be_extracted_from_loaded_pdf() -> lopdf::Result<()> {
let doc = Document::load("assets/unicode.pdf")?;
Expand All @@ -136,3 +137,12 @@ fn unicode_can_be_extracted_from_loaded_pdf() -> lopdf::Result<()> {
assert_eq!(extracted_text.replace("\n", ""), "πŸ˜€πŸ”§πŸ”¨");
Ok(())
}

#[cfg(feature = "async")]
#[tokio::test]
async fn unicode_can_be_extracted_from_loaded_pdf() -> lopdf::Result<()> {
let doc = Document::load("assets/unicode.pdf").await?;
let extracted_text = get_text_from_first_page(&doc);
assert_eq!(extracted_text.replace("\n", ""), "πŸ˜€πŸ”§πŸ”¨");
Ok(())
}

0 comments on commit 29f83e2

Please sign in to comment.