-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.rs
46 lines (38 loc) · 833 Bytes
/
lib.rs
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
#![allow(unused_imports)]
#[macro_use]
extern crate rucky;
import_crates! {
toml, regex, rustc_serialize;
}
#[test]
fn rustc_compiles_this() {
// This function will be successfully compiled
// if macro expanded correctly.
}
#[test]
fn specify_member() {
import! {
std::io *;
toml {Value, Table};
rustc_serialize::json {Json, Builder, AsJson};
std::path {Path, PathBuf};
}
}
#[test]
fn use_imported_member() {
import!(std::collections::BTreeMap);
let mut map = BTreeMap::<i32, Vec<f64>>::new();
map.insert(5, vec![2.0, 4.5]);
assert_eq!(map.get(&5).unwrap().as_slice(), &[2.0, 4.5]);
}
#[test]
fn one_liner_glob_import() {
import!(std::io::prelude *);
import!(regex *);
}
#[test]
fn semicolon_sep() {
import_crates! {
rand; libc;
}
}