-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bd2698
commit 9567e45
Showing
5 changed files
with
149 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
title: All sections | ||
format: wordcount-markdown | ||
|
||
references: | ||
- id: Lovelace1842 | ||
author: | ||
- family: Lovelace | ||
given: Ada Augusta | ||
citation-key: Lovelace1842 | ||
container-title: Taylor's Scientific Memoirs | ||
issued: | ||
- year: 1842 | ||
language: en-GB | ||
page: 666–731 | ||
title: >- | ||
Sketch of the analytical engine invented by Charles Babbage, by LF Menabrea, | ||
officer of the military engineers, with notes upon the memoir by the | ||
translator | ||
type: article-journal | ||
volume: 3 | ||
--- | ||
|
||
Here are four words [@Lovelace1842].^[A note] | ||
|
||
::: {#appendix-count} | ||
|
||
There are five words here. | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: No appendix, no notes | ||
format: wordcount-markdown | ||
|
||
references: | ||
- id: Lovelace1842 | ||
author: | ||
- family: Lovelace | ||
given: Ada Augusta | ||
citation-key: Lovelace1842 | ||
container-title: Taylor's Scientific Memoirs | ||
issued: | ||
- year: 1842 | ||
language: en-GB | ||
page: 666–731 | ||
title: >- | ||
Sketch of the analytical engine invented by Charles Babbage, by LF Menabrea, | ||
officer of the military engineers, with notes upon the memoir by the | ||
translator | ||
type: article-journal | ||
volume: 3 | ||
--- | ||
|
||
Here are four words [@Lovelace1842]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: Single word in notes | ||
format: wordcount-markdown | ||
--- | ||
|
||
Here are four words.^[Note] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
test_that("terminal output is correct; no appendix, no notes", { | ||
test_file <- test_file_parts(here::here("tests/testthat/test-terminal-output-no-app-notes.qmd")) | ||
|
||
create_local_quarto_project(test_file = test_file) | ||
|
||
actual_output <- capture.output( | ||
quarto::quarto_render(input = test_file$qmd, quiet = FALSE) | ||
) |> extract_output() | ||
|
||
true_output <- "Overall totals: | ||
-------------------------------- | ||
• 40 total words | ||
• 6 words in body and notes | ||
Section totals: | ||
-------------------------------- | ||
• 6 words in text body | ||
• 34 words in reference section | ||
" | ||
|
||
expect_equal(actual_output, true_output) | ||
}) | ||
|
||
test_that("terminal output is correct; all sections", { | ||
test_file <- test_file_parts(here::here("tests/testthat/test-terminal-output-all-sections.qmd")) | ||
|
||
create_local_quarto_project(test_file = test_file) | ||
|
||
actual_output <- capture.output( | ||
quarto::quarto_render(input = test_file$qmd, quiet = FALSE) | ||
) |> extract_output() | ||
|
||
true_output <- "Overall totals: | ||
-------------------------------- | ||
• 47 total words | ||
• 8 words in body and notes | ||
Section totals: | ||
-------------------------------- | ||
• 6 words in text body | ||
• 2 words in notes | ||
• 34 words in reference section | ||
• 5 words in appendix section | ||
" | ||
|
||
expect_equal(actual_output, true_output) | ||
}) | ||
|
||
test_that("terminal output is correct; singular 'word' works", { | ||
test_file <- test_file_parts(here::here("tests/testthat/test-terminal-output-single-word.qmd")) | ||
|
||
create_local_quarto_project(test_file = test_file) | ||
|
||
actual_output <- capture.output( | ||
quarto::quarto_render(input = test_file$qmd, quiet = FALSE) | ||
) |> extract_output() | ||
|
||
true_output <- "Overall totals: | ||
---------------------------- | ||
• 5 total words | ||
• 5 words in body and notes | ||
Section totals: | ||
---------------------------- | ||
• 4 words in text body | ||
• 1 word in notes | ||
" | ||
|
||
expect_equal(actual_output, true_output) | ||
}) |