--- /dev/null
+diff --git a/tests/comments.rs b/tests/comments.rs
+index 4f7236d..414f098 100644
+--- a/tests/comments.rs
++++ b/tests/comments.rs
+@@ -1,5 +1,5 @@
+ #![allow(clippy::assertions_on_result_states)]
+-
++extern crate proc_macro2;
+ use proc_macro2::{Delimiter, Literal, Spacing, TokenStream, TokenTree};
+
+ // #[doc = "..."] -> "..."
+diff --git a/tests/marker.rs b/tests/marker.rs
+index 4fb2beb..fe8e031 100644
+--- a/tests/marker.rs
++++ b/tests/marker.rs
+@@ -1,3 +1,4 @@
++extern crate proc_macro2;
+ use proc_macro2::{
+ Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree,
+ };
+diff --git a/tests/test.rs b/tests/test.rs
+index e0af151..f12b489 100644
+--- a/tests/test.rs
++++ b/tests/test.rs
+@@ -3,7 +3,7 @@
+ clippy::items_after_statements,
+ clippy::non_ascii_literal
+ )]
+-
++extern crate proc_macro2;
+ use proc_macro2::{Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
+ use std::iter;
+ use std::panic;
Source: %{crate}-%{version}.tar.gz
Source1: %{name}.manifest
Source2: extern_core-unicode_ident.patch
+Source3: extern_test.patch
+
# ==========================================================
# BuildRequires
BuildRequires: rust
BuildRequires: rust-unicode-ident
+# ==========================================================
+# dev-dependencies
+# ==========================================================
+%if 0%{?run_tests}
+BuildRequires: rust-proc-macro2
+%endif
%description
Substitute implementation of the compiler's `proc_macro` API to decouple token-
%setup -q
cp %{SOURCE1} .
%{__patch} -p1 < %{SOURCE2}
+%{__patch} -p1 < %{SOURCE3}
# ==========================================================
# build section
--cfg=wrap_proc_macro \
./src/lib.rs
+%check
+%if 0%{?run_tests}
+export unit_test_list="test comments marker features"
+
+for unit_test in ${unit_test_list}
+do
+%{rustc_dylib_build} --test \
+ --crate-name=${unit_test} \
+ -lunicode_ident \
+ --cfg='feature="default"' \
+ --cfg='feature="proc-macro"' \
+ --cfg='feature="span-locations"' \
+ --cfg=span_locations \
+ --cfg=use_proc_macro \
+ --cfg=wrap_proc_macro \
+ --extern %{real_crate_name}=./lib%{real_crate_name}.so \
+ ./tests/${unit_test}.rs
+done
+
+for unit_test in ${unit_test_list}
+do
+./${unit_test}
+done
+%endif
+
# ==========================================================
# install section
# ==========================================================