Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Test.{Result, Pass, Fail, Error, Broken} in documentation #31854

Merged
merged 1 commit into from
Feb 12, 2023

Conversation

tkf
Copy link
Member

@tkf tkf commented Apr 27, 2019

The docstrings of the public API are already referring to Test.Result and its subtypes. Also, querying test results seems to be a popular demand [1]. So, I think it makes sense to signal that they are public API by including them in the documentation.

[1] For example, it would be nice if the exception thrown in @test_throws can be accessed. It can be done by

result = @test_throws Exception f()
@test occursin("error message", sprint(showerror, result.value))

However, since Pass and its fields are not documented, I cannot use this API (see also https://discourse.julialang.org/t/19224). Another example is to provide debug info upon test failure #31495.


All tests produce a result object. This object may or may not be
stored, depending on whether the test is part of a test set.
"""
abstract type Result end

"""
Pass
Test.Pass <: Test.Result
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the prefix Test. here and to the other types to signify that those types are not exported. I think <: Test.Result also clarifies what they are.

@simonbyrne simonbyrne added domain:docs This change adds or pertains to documentation testsystem The unit testing framework and Test stdlib labels Nov 30, 2022
@vtjnash vtjnash added the status:merge me PR is reviewed. Merge when all tests are passing label Feb 10, 2023
@DilumAluthge DilumAluthge merged commit e8b9b5b into JuliaLang:master Feb 12, 2023
@DilumAluthge DilumAluthge removed the status:merge me PR is reviewed. Merge when all tests are passing label Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation testsystem The unit testing framework and Test stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants