-
Notifications
You must be signed in to change notification settings - Fork 115
docs(@test): explain snapshot test #2024
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
base: main
Are you sure you want to change the base?
Conversation
Inconsistent documentation style between functionsCategory ///| Expected used in test block, don't catch this error.
///
/// Parameters:
/// - msg: The error message to display
/// - loc~: Source location of the failure (optional)
/// Produces an error message similar to @builtin.fail. Reasoning Example code could be more comprehensiveCategory /// ```
/// test {
/// let t = new("test.txt")
/// t.writeln("hello")
/// t.snapshot!(filename="test.txt") // Write snapshot and end test
///
/// // This won't execute:
/// t.writeln("world")
/// // Cannot find `world` in `test.txt`
/// }
/// ```
**Reasoning**
The current example contains a typo ('Cann't') and could better illustrate the consequences of the snapshot function being a terminal operation. Clear examples help prevent misuse of the API.
</details>
<details>
<summary> Missing return type documentation </summary>
**Category**
Correctness
**Code Snippet**
pub fn fail[T](msg : String, loc~ : SourceLoc = _) -> T!
pub fn write(self : T, obj : &Show) -> Unit
**Recommendation**
Add return type documentation for all functions. For example:
```moonbit
///| Expected used in test block, don't catch this error.
///
/// Parameters:
/// - msg: The error message to display
/// - loc~: Source location of the failure (optional)
/// Returns:
/// Never returns normally, always fails with the given message
/// Produces an error message similar to @builtin.fail. Reasoning |
Pull Request Test Coverage Report for Build 6484Details
💛 - Coveralls |
28cb20d
to
a0581e6
Compare
We'll try to solve the issue with the snapshot testing |
related issues: moonbitlang/moon#720