OpenViSTAI · Agents · Blockchain · Crypto
Menu

OPENVIST LEARN · FREE LESSONS

Test, review and connect Rust recipes

Verify the downloaded program, inspect its limits and choose a next practice task.

Lesson 30 of 30 · About 30 minutes · Beginner · English

By the end of this lesson

Verify the downloaded program, inspect its limits and choose a next practice task.

Before you start

  • Rust 1.90.0 or later, a terminal and a plain-text editor. Examples were tested with Rust 1.90.0, Edition 2024 on Linux.
  • Complete lesson 29, or be comfortable explaining and running its examples.

Three words to know

Regression test
A recorded case that protects behaviour when code changes.
stderr/stdout separation
Diagnostics and reports use different streams.
Review scope
What was actually tested, and what remains outside the evidence.

1. Understand the idea

The downloadable source includes sixteen test functions for the parser and formatter. They cover valid counts, optional final LF, duplicate rows, invalid status/header/title/UTF-8, BOM and CRLF rejection, blank records and byte/row boundaries. A project-level run should also check the CLI boundary: missing paths, extra arguments and late invalid rows must not produce a partial report. Test names describe intent, not a certification of production readiness.

2. Save, run and observe

Save this complete program as status_test.rs in a fresh practice folder. It replaces that lesson file only; keep earlier examples separately. Compile it with rustc, then run the executable. Rust source goes in the editor; rustc and cargo commands go in the terminal.

Run the recorded testsTERMINAL · Bash or Windows PowerShell
cargo test --offline
What you should see · example output
The built-in tests report 16 passed and 0 failed; timing and harness formatting vary.
A separate regression exampleRUST · save as status_test.rs
fn accepts_status(value: &str) -> bool { matches!(value, "open" | "closed") }
fn main() { println!("uppercase={}", accepts_status("OPEN")); }
#[cfg(test)]
mod tests {
    use super::*;
    #[test] fn accepts_known() { assert!(accepts_status("open")); assert!(accepts_status("closed")); }
    #[test] fn rejects_other() { assert!(!accepts_status("OPEN")); assert!(!accepts_status("")); }
}
What you should see · example output
uppercase=false

3. Explain the result

This route covers foundations, not the whole Rust language. Async runtimes, threads, advanced smart pointers, unsafe Rust, FFI, web frameworks, distributed services and production deployment need separate study. Choose a published Rust recipe and read its inputs, version, licence and recorded test scope before adapting it. No recipe is executed by reading or copying this lesson. For the next exercise, explain the project without looking at the code, then add a failing boundary test before changing behaviour.

YOUR TURN

A small check before you continue

An input has a valid first record and an invalid second status. What should the CLI emit?

Show a suggested answer

No stdout report, error: invalid input on stderr and exit status 2. A total for the first row would be a misleading partial result.

Sources and scope

Documentation and examples reviewed 2026-10-18. Provider screens, package versions and output wording can differ. Examples show expected outcomes; they are not a claim that OpenViST connected to your server or verified your setup.

Keep learning with a real example