Debian Codegraph @

third_party/rust/uniffi_bindgen/src/bindings/ruby/gen_ruby/tests.rs

raw
1 use super::{is_reserved_word, Config};
2
3 #[test]
4 fn when_reserved_word() {
5 assert!(is_reserved_word("end"));
6 }
7
8 #[test]
9 fn when_not_reserved_word() {
10 assert!(!is_reserved_word("ruby"));
11 }
12
13 #[test]
14 fn cdylib_name() {
15 let config = Config {
16 cdylib_name: None,
17 cdylib_path: None,
18 };
19
20 assert_eq!("uniffi", config.cdylib_name());
21
22 let config = Config {
23 cdylib_name: Some("todolist".to_string()),
24 cdylib_path: None,
25 };
26
27 assert_eq!("todolist", config.cdylib_name());
28 }
29
30 #[test]
31 fn cdylib_path() {
32 let config = Config {
33 cdylib_name: None,
34 cdylib_path: None,
35 };
36
37 assert_eq!("", config.cdylib_path());
38 assert!(!config.custom_cdylib_path());
39
40 let config = Config {
41 cdylib_name: None,
42 cdylib_path: Some("/foo/bar".to_string()),
43 };
44
45 assert_eq!("/foo/bar", config.cdylib_path());
46 assert!(config.custom_cdylib_path());
47 }