-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from Anders429/master
Allow raw identifiers.
- Loading branch information
Showing
2 changed files
with
80 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(); | ||
} |