aboutsummaryrefslogtreecommitdiff
path: root/src/repeat.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-03-05 19:46:12 +0100
committerHampusM <hampus@hampusmat.com>2023-03-05 20:05:22 +0100
commit3d9c9d7ac68a439a29c8ad0a745a7e2a52234a44 (patch)
treeae37e7242f2ed611ee862f046ae20d235df49e81 /src/repeat.rs
parent57ab49b24ed34fcddadb1a293511ee74a066e026 (diff)
refactor: improve replacement syntax
Diffstat (limited to 'src/repeat.rs')
-rw-r--r--src/repeat.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/repeat.rs b/src/repeat.rs
index 5d9ece7..fe7523c 100644
--- a/src/repeat.rs
+++ b/src/repeat.rs
@@ -125,6 +125,7 @@ mod tests
{
use opengl_registry::command::{Command, Parameter, Prototype};
use pretty_assertions::assert_eq;
+ use proc_macro2::{Punct, Spacing};
use quote::quote;
use super::*;
@@ -147,12 +148,14 @@ mod tests
),
]);
+ let ht = Punct::new('#', Spacing::Alone);
+
assert_eq!(
for_each_opengl_command_impl(
&quote! {
unsafe {
- functions::_gl_command_ = FunctionPtr::new_initialized(
- get_proc_addr(stringify!(_gl_command_))
+ functions::#ht gl_command = FunctionPtr::new_initialized(
+ get_proc_addr(stringify!(#ht gl_command))
);
}
},
@@ -182,7 +185,7 @@ mod tests
assert_eq!(
for_each_opengl_command_impl(
&quote! {
- fn _gl_command_(_gl_command_args_) -> _gl_command_ret_type_ {}
+ fn #ht gl_command(#ht gl_command_args) -> #ht gl_command_ret_type {}
},
&registry,
)