diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 8fa06bd..1f6b156 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-01T00:37:58","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-01T00:43:11","documenter_version":"1.6.0"}} \ No newline at end of file diff --git a/dev/assets/documenter.js b/dev/assets/documenter.js index b2bdd43..82252a1 100644 --- a/dev/assets/documenter.js +++ b/dev/assets/documenter.js @@ -77,30 +77,35 @@ require(['jquery'], function($) { let timer = 0; var isExpanded = true; -$(document).on("click", ".docstring header", function () { - let articleToggleTitle = "Expand docstring"; - - debounce(() => { - if ($(this).siblings("section").is(":visible")) { - $(this) - .find(".docstring-article-toggle-button") - .removeClass("fa-chevron-down") - .addClass("fa-chevron-right"); - } else { - $(this) - .find(".docstring-article-toggle-button") - .removeClass("fa-chevron-right") - .addClass("fa-chevron-down"); +$(document).on( + "click", + ".docstring .docstring-article-toggle-button", + function () { + let articleToggleTitle = "Expand docstring"; + const parent = $(this).parent(); + + debounce(() => { + if (parent.siblings("section").is(":visible")) { + parent + .find("a.docstring-article-toggle-button") + .removeClass("fa-chevron-down") + .addClass("fa-chevron-right"); + } else { + parent + .find("a.docstring-article-toggle-button") + .removeClass("fa-chevron-right") + .addClass("fa-chevron-down"); - articleToggleTitle = "Collapse docstring"; - } + articleToggleTitle = "Collapse docstring"; + } - $(this) - .find(".docstring-article-toggle-button") - .prop("title", articleToggleTitle); - $(this).siblings("section").slideToggle(); - }); -}); + parent + .children(".docstring-article-toggle-button") + .prop("title", articleToggleTitle); + parent.siblings("section").slideToggle(); + }); + } +); $(document).on("click", ".docs-article-toggle-button", function (event) { let articleToggleTitle = "Expand docstring"; @@ -110,7 +115,7 @@ $(document).on("click", ".docs-article-toggle-button", function (event) { debounce(() => { if (isExpanded) { $(this).removeClass("fa-chevron-up").addClass("fa-chevron-down"); - $(".docstring-article-toggle-button") + $("a.docstring-article-toggle-button") .removeClass("fa-chevron-down") .addClass("fa-chevron-right"); @@ -119,7 +124,7 @@ $(document).on("click", ".docs-article-toggle-button", function (event) { $(".docstring section").slideUp(animationSpeed); } else { $(this).removeClass("fa-chevron-down").addClass("fa-chevron-up"); - $(".docstring-article-toggle-button") + $("a.docstring-article-toggle-button") .removeClass("fa-chevron-right") .addClass("fa-chevron-down"); diff --git a/dev/guide/index.html b/dev/guide/index.html index a073a74..5338e37 100644 --- a/dev/guide/index.html +++ b/dev/guide/index.html @@ -45,4 +45,4 @@ Tests passed: 3 TESTING SUCCESSFUL! julia> success -true +true diff --git a/dev/index.html b/dev/index.html index 3159cab..03ad90e 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · NarrativeTest.jl

NarrativeTest.jl Documentation

NarrativeTest is a Julia library for functional testing, which lets you write the test suite in the narrative form. It permits you to describe the behavior of software components in the Markdown format, and then extract, execute, and validate any embedded test code.

NarrativeTest can be compared to the Doctest module (see also Documenter.jl). It differs from Doctest in its approach to syntax: instead of presenting the test suite as a part of an interactive session, NarrativeTest uses plain code blocks with expected output in comments. It also focuses less on docstrings and documentation examples, and more on validating the ergonomics of API with "literate testing".

Contents

Index

+Home · NarrativeTest.jl

NarrativeTest.jl Documentation

NarrativeTest is a Julia library for functional testing, which lets you write the test suite in the narrative form. It permits you to describe the behavior of software components in the Markdown format, and then extract, execute, and validate any embedded test code.

NarrativeTest can be compared to the Doctest module (see also Documenter.jl). It differs from Doctest in its approach to syntax: instead of presenting the test suite as a part of an interactive session, NarrativeTest uses plain code blocks with expected output in comments. It also focuses less on docstrings and documentation examples, and more on validating the ergonomics of API with "literate testing".

Contents

Index

diff --git a/dev/reference/index.html b/dev/reference/index.html index a981a59..cda755c 100644 --- a/dev/reference/index.html +++ b/dev/reference/index.html @@ -1,13 +1,13 @@ -API Reference · NarrativeTest.jl

API Reference

NarrativeTest.runtestsFunction
runtests(files; subs = common_subs(), mod = nothing, quiet = false, exitfirst = false, maxfail = nothing) :: Bool

Load the specified Markdown files to extract and run the embedded test cases. When a directory is passed, load all *.md files in the directory. This function returns true if the testing is successful, false otherwise.

Specify subs to customize substitutions applied to the expected output in order to convert it to a regular expression.

Specify mod to execute tests in the context of the given module.

Set quiet = true to suppress all output except for error reports.

Set exitfirst = true to exit on first error or failure. Alternatively, use maxfail to set maximum allowable number of errors or failures.

runtests(; default = common_args(), subs = common_subs(), mod = nothing, quiet = false, exitfirst = false, maxfail = nothing)

In this form, test files are specified as command-line parameters. When invoked without parameters, tests are loaded from *.md files in the program directory, which can be overriden using default parameter. This function terminates the program with code 0 if the testing is successful, 1 otherwise.

Use this form in test/runtests.jl:

using NarrativeTest
-NarrativeTest.runtests()
source
NarrativeTest.testsetFunction
testset(files = nothing;
+API Reference · NarrativeTest.jl

API Reference

NarrativeTest.runtestsFunction
runtests(files; subs = common_subs(), mod = nothing, quiet = false, exitfirst = false, maxfail = nothing) :: Bool

Load the specified Markdown files to extract and run the embedded test cases. When a directory is passed, load all *.md files in the directory. This function returns true if the testing is successful, false otherwise.

Specify subs to customize substitutions applied to the expected output in order to convert it to a regular expression.

Specify mod to execute tests in the context of the given module.

Set quiet = true to suppress all output except for error reports.

Set exitfirst = true to exit on first error or failure. Alternatively, use maxfail to set maximum allowable number of errors or failures.

runtests(; default = common_args(), subs = common_subs(), mod = nothing, quiet = false, exitfirst = false, maxfail = nothing)

In this form, test files are specified as command-line parameters. When invoked without parameters, tests are loaded from *.md files in the program directory, which can be overriden using default parameter. This function terminates the program with code 0 if the testing is successful, 1 otherwise.

Use this form in test/runtests.jl:

using NarrativeTest
+NarrativeTest.runtests()
source
NarrativeTest.testsetFunction
testset(files = nothing;
         default = common_args(), subs = common_subs(), mod = nothing, quiet = false, exitfirst = false, maxfail = nothing)

Run NarrativeTest-based tests as a nested test set. For example, invoke it in test/runtests.jl:

using Test, NarrativeTest
 
 @testset "MyPackage" begin
     …
     NarrativeTest.testset()
     …
-end

The given Markdown files are analyized to extract and run the embedded test cases. When a directory is passed, all nested *.md files are loaded. When invoked without arguments, all *.md files in the program directory are loaded, which can be overridden using the default parameter.

Specify subs to customize substitutions applied to the expected output in order to convert it to a regular expression.

Specify mod to execute tests in the context of the given module.

Set quiet = true to suppress all output except for error reports.

source
NarrativeTest.runtestFunction
runtest(test::TestCase; subs = common_subs(), mod = nothing) :: AbstractResult
-runtest(loc, code; pre = nothing, expect = nothing, subs = common_subs(), mod = nothing) :: AbstractResult

Run the given test case, return the result.

source
NarrativeTest.parsemdFunction
parsemd(file) :: Vector{AbstractTestCase}
-parsemd(name, io) :: Vector{AbstractTestCase}

Parse the specified Markdown file to extract the embedded test suite; return a list of test cases.

source
NarrativeTest.parsejlFunction
parsejl(file) :: Vector{AbstractTestCase}
-parsejl(name, io) :: Vector{AbstractTestCase}

Load the specified Julia source file and extract the embedded test suite; return a list of test cases.

source
NarrativeTest.common_subsFunction
common_subs() :: Vector{Pair{Regex,SubstitutionString{String}}}

Substitutions applied to the expected output in order to convert it to a regular expression.

source
+end

The given Markdown files are analyized to extract and run the embedded test cases. When a directory is passed, all nested *.md files are loaded. When invoked without arguments, all *.md files in the program directory are loaded, which can be overridden using the default parameter.

Specify subs to customize substitutions applied to the expected output in order to convert it to a regular expression.

Specify mod to execute tests in the context of the given module.

Set quiet = true to suppress all output except for error reports.

source
NarrativeTest.runtestFunction
runtest(test::TestCase; subs = common_subs(), mod = nothing) :: AbstractResult
+runtest(loc, code; pre = nothing, expect = nothing, subs = common_subs(), mod = nothing) :: AbstractResult

Run the given test case, return the result.

source
NarrativeTest.parsemdFunction
parsemd(file) :: Vector{AbstractTestCase}
+parsemd(name, io) :: Vector{AbstractTestCase}

Parse the specified Markdown file to extract the embedded test suite; return a list of test cases.

source
NarrativeTest.parsejlFunction
parsejl(file) :: Vector{AbstractTestCase}
+parsejl(name, io) :: Vector{AbstractTestCase}

Load the specified Julia source file and extract the embedded test suite; return a list of test cases.

source
NarrativeTest.common_subsFunction
common_subs() :: Vector{Pair{Regex,SubstitutionString{String}}}

Substitutions applied to the expected output in order to convert it to a regular expression.

source
diff --git a/dev/test/index.html b/dev/test/index.html index 3f4c3d9..81bcada 100644 --- a/dev/test/index.html +++ b/dev/test/index.html @@ -520,4 +520,4 @@ =#

A test case can be executed in the context of a specific module.

runtest(@__FILE__, "hello = \"Hello World!\"", mod=Main)
 
 Main.hello
-#-> "Hello World!"
+#-> "Hello World!"