File: raw_identifiers.rs

package info (click to toggle)
rust-getset 0.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 168 kB
  • sloc: makefile: 4
file content (57 lines) | stat: -rw-r--r-- 1,059 bytes parent folder | download
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
#[macro_use]
extern crate getset;

#[derive(CopyGetters, Default, Getters, MutGetters, Setters)]
struct RawIdentifiers {
    #[get]
    r#type: usize,
    #[get_copy]
    r#move: usize,
    #[get_mut]
    r#union: usize,
    #[set]
    r#enum: usize,
    #[get = "with_prefix"]
    r#const: usize,
    #[get_copy = "with_prefix"]
    r#if: usize,
    // Ensure having no gen mode doesn't break things.
    #[allow(dead_code)]
    r#loop: usize,
}

#[test]
fn test_get() {
    let val = RawIdentifiers::default();
    let _ = val.r#type();
}

#[test]
fn test_get_copy() {
    let val = RawIdentifiers::default();
    let _ = val.r#move();
}

#[test]
fn test_get_mut() {
    let mut val = RawIdentifiers::default();
    let _ = val.union_mut();
}

#[test]
fn test_set() {
    let mut val = RawIdentifiers::default();
    val.set_enum(42);
}

#[test]
fn test_get_with_prefix() {
    let val = RawIdentifiers::default();
    let _ = val.get_const();
}

#[test]
fn test_get_copy_with_prefix() {
    let val = RawIdentifiers::default();
    let _ = val.get_if();
}