blob: 59cb8e4a04645d48570759fc50b431281beb3819 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
extern crate cc_test;
use cc_test::*;
#[link(name = "OptLinkage", kind = "static")]
extern "C" {
fn answer() -> i32;
}
#[test]
fn foo_here() {
unsafe {
assert_eq!(foo(), 4);
}
}
#[test]
fn bar_here() {
unsafe {
assert_eq!(bar1(), 5);
assert_eq!(bar2(), 6);
}
}
#[test]
fn asm_here() {
unsafe {
assert_eq!(asm(), 7);
}
}
#[test]
fn baz_here() {
unsafe {
assert_eq!(baz(), 8);
}
}
#[test]
#[cfg(windows)]
fn windows_here() {
unsafe {
windows();
}
}
#[test]
#[cfg(target_env = "msvc")]
fn msvc_here() {
unsafe {
msvc();
}
}
#[test]
fn opt_linkage() {
unsafe {
assert_eq!(answer(), 42);
}
}
|