From 5b4e0fcd1d470a56f9347cb15b655c0e996a3b73 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 14 Apr 2023 09:18:58 +0900 Subject: [PATCH] Add unittest [ 11s] running 2 tests [ 11s] test char::test_encode_utf8_oob ... ok [ 12s] test char::test_encode_utf8 ... ok [ 12s] [ 12s] test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s --- packaging/matches_extern.patch | 13 +++++++++++++ packaging/rust-arrayvec.spec | 20 +++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 packaging/matches_extern.patch diff --git a/packaging/matches_extern.patch b/packaging/matches_extern.patch new file mode 100644 index 0000000..b302692 --- /dev/null +++ b/packaging/matches_extern.patch @@ -0,0 +1,13 @@ +diff --git a/src/char.rs b/src/char.rs +index 939b6b4..ae337aa 100644 +--- a/src/char.rs ++++ b/src/char.rs +@@ -10,6 +10,8 @@ + // + // Original authors: alexchrichton, bluss + ++extern crate matches; ++ + // UTF-8 ranges and tags for encoding characters + const TAG_CONT: u8 = 0b1000_0000; + const TAG_TWO_B: u8 = 0b1100_0000; diff --git a/packaging/rust-arrayvec.spec b/packaging/rust-arrayvec.spec index 03c3e19..be92f9d 100644 --- a/packaging/rust-arrayvec.spec +++ b/packaging/rust-arrayvec.spec @@ -15,6 +15,7 @@ License: MIT OR Apache-2.0 URL: https://crates.io/crates/arrayvec Source: %{crate}-%{version}.tar.gz Source1: %{name}.manifest +Source2: matches_extern.patch # ========================================================== # BuildRequires @@ -26,9 +27,11 @@ BuildRequires: rust-serde # ========================================================== # dev-dependencies # ========================================================== +%if 0%{?run_tests} # BuildRequires: rust-bencher -# BuildRequires: rust-matches # BuildRequires: rust-serde_test +BuildRequires: rust-matches +%endif %description @@ -38,6 +41,9 @@ too). Implements fixed capacity ArrayVec and ArrayString. %prep %setup -q cp %{SOURCE1} . +%if 0%{?run_tests} +%{__patch} -p1 < %{SOURCE2} +%endif # ========================================================== # build section @@ -57,6 +63,18 @@ cp %{SOURCE1} . install -d -m 0755 %{buildroot}%{_rust_dylibdir} install -m 0644 lib%{real_crate_name}.so %{buildroot}/%{_rust_dylibdir}/lib%{real_crate_name}.so +%check +%if 0%{?run_tests} +%{rustc_std_build} --test --crate-type=dylib \ + --crate-name=%{real_crate_name} \ + %{?rustc_edition:--edition=%{rustc_edition}} \ + %rust_dylib_extern matches \ + --cfg='feature="std"' \ + ./src/lib.rs + +./%{real_crate_name} +%endif + %clean %post -p /sbin/ldconfig -- 2.34.1