Add unittest accepted/tizen_9.0_unified accepted/tizen_rust accepted/tizen_unified accepted/tizen_unified_dev accepted/tizen_unified_x tizen tizen_9.0 accepted/tizen/9.0/unified/20241030.234013 accepted/tizen/rust/20231016.021715 accepted/tizen/unified/20240328.122929 accepted/tizen/unified/dev/20240620.002145 accepted/tizen/unified/x/20240328.130820 tizen_9.0_m2_release
authorWoohyun Jung <wh0705.jung@samsung.com>
Thu, 4 May 2023 01:54:38 +0000 (10:54 +0900)
committerWoohyun Jung <wh0705.jung@samsung.com>
Thu, 4 May 2023 01:54:38 +0000 (10:54 +0900)
[   36s] + ./test
[   36s]
[   36s] running 36 tests
[   37s] test default_tokenstream_is_empty ... ok
[   37s] test byte_order_mark ... ok
[   37s] test ident_empty - should panic ... ok
[   37s] test ident_invalid - should panic ... ok
[   37s] test ident_number - should panic ... ok
[   37s] test fail ... ok
[   37s] test ident_raw_underscore - should panic ... ok
[   37s] test ident_raw_reserved - should panic ... ok
[   37s] test joint_last_token ... ok
[   37s] test idents ... ok
[   37s] test lifetime_empty - should panic ... ok
[   37s] test lifetime_invalid ... ok
[   37s] test lifetime_number - should panic ... ok
[   37s] test literal_byte_string ... ok
[   37s] test literal_character ... ok
[   37s] test literal_float ... ok
[   37s] test literal_integer ... ok
[   37s] test literal_iter_negative ... ok
[   37s] test literal_parse ... ok
[   37s] test literal_raw_string ... ok
[   37s] test literal_string ... ok
[   37s] test literal_suffix ... ok
[   37s] test no_panic ... ok
[   37s] test punct_before_comment ... ok
[   37s] test non_ascii_tokens ... ok
[   37s] test raw_ident_invalid - should panic ... ok
[   37s] test raw_ident_number - should panic ... ok
[   37s] test raw_identifier ... ok
[   37s] test raw_idents ... ok
[   37s] test roundtrip ... ok
[   37s] test test_debug_ident ... ok
[   37s] test raw_ident_empty - should panic ... ok
[   37s] test tokenstream_size_hint ... ok
[   37s] test tuple_indexing ... ok
[   37s] test span_test ... ok
[   37s] test test_debug_tokenstream ... ok
[   37s]
[   37s] test result: ok. 36 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
[   37s]
[   37s] + for unit_test in '${unit_test_list}'
[   37s] + ./comments
[   37s]
[   37s] running 4 tests
[   37s] test closed_immediately ... ok
[   37s] test incomplete ... ok
[   37s] test carriage_return ... ok
[   37s] test lit ... ok
[   37s]
[   37s] test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
[   37s]
[   37s] + for unit_test in '${unit_test_list}'
[   37s] + ./marker
[   37s]
[   37s] running 20 tests
[   37s] test Delimiter ... ok
[   37s] test Group ... ok
[   37s] test Ident ... ok
[   37s] test LexError ... ok
[   37s] test Literal ... ok
[   37s] test Punct ... ok
[   37s] test Spacing ... ok
[   37s] test Span ... ok
[   37s] test TokenStream ... ok
[   37s] test TokenTree ... ok
[   37s] test unwind_safe::Delimiter ... ok
[   37s] test unwind_safe::Group ... ok
[   37s] test unwind_safe::Ident ... ok
[   37s] test unwind_safe::LexError ... ok
[   37s] test unwind_safe::Punct ... ok
[   37s] test unwind_safe::Literal ... ok
[   37s] test unwind_safe::Spacing ... ok
[   37s] test unwind_safe::Span ... ok
[   37s] test unwind_safe::TokenStream ... ok
[   37s] test unwind_safe::TokenTree ... ok
[   37s]
[   37s] test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
[   37s]
[   37s] + for unit_test in '${unit_test_list}'
[   37s] + ./features
[   37s]
[   37s] running 1 test
[   37s] test make_sure_no_proc_macro ... ignored
[   37s]
[   37s] test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s

packaging/extern_test.patch [new file with mode: 0644]
packaging/rust-proc-macro2.spec

diff --git a/packaging/extern_test.patch b/packaging/extern_test.patch
new file mode 100644 (file)
index 0000000..06d6e8b
--- /dev/null
@@ -0,0 +1,33 @@
+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;
index 132ca9be78a45277638b837979e6f2615adc04f4..546ef62eaf3919cfeecd93045b750203a1fee53f 100644 (file)
@@ -15,6 +15,8 @@ URL:            https://crates.io/crates/proc-macro2
 Source:         %{crate}-%{version}.tar.gz
 Source1:        %{name}.manifest
 Source2:        extern_core-unicode_ident.patch
+Source3:        extern_test.patch
+
 
 # ==========================================================
 # BuildRequires
@@ -23,6 +25,12 @@ Source2:        extern_core-unicode_ident.patch
 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-
@@ -32,6 +40,7 @@ based libraries from the procedural macro use case.
 %setup -q
 cp %{SOURCE1} .
 %{__patch} -p1 < %{SOURCE2}
+%{__patch} -p1 < %{SOURCE3}
 
 # ==========================================================
 # build section
@@ -48,6 +57,31 @@ cp %{SOURCE1} .
         --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
 # ==========================================================