File: option.rs

package info (click to toggle)
rust-fehler 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 132 kB
  • sloc: makefile: 4
file content (17 lines) | stat: -rw-r--r-- 235 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use fehler::*;

#[throws(as Option)]
fn foo(x: bool) -> i32 {
    if x { throw!(); }
    0
}

#[test]
fn test_outcome_true() {
    assert!(foo(true).is_none())
}

#[test]
fn test_outcome_false() {
    assert_eq!(Some(0), foo(false))
}