blob: fc546a6570f0a6eea371a3b7f5bf05672b6e3ed5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  | 
use std::assert_matches::assert_matches;
use std::str::FromStr;
use super::*;
#[allow(non_snake_case)]
#[test]
fn lookup_Rust() {
    let abi = ExternAbi::from_str("Rust");
    assert!(abi.is_ok() && abi.unwrap().as_str() == "Rust");
}
#[test]
fn lookup_cdecl() {
    let abi = ExternAbi::from_str("cdecl");
    assert!(abi.is_ok() && abi.unwrap().as_str() == "cdecl");
}
#[test]
fn lookup_baz() {
    let abi = ExternAbi::from_str("baz");
    assert_matches!(abi, Err(AbiFromStrErr::Unknown));
}
#[test]
fn guarantee_lexicographic_ordering() {
    let abis = ExternAbi::ALL_VARIANTS;
    let mut sorted_abis = abis.to_vec();
    sorted_abis.sort_unstable();
    assert_eq!(abis, sorted_abis);
}
 
  |