Add unittest accepted/tizen_rust tizen accepted/tizen/rust/20231016.020751
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 14 Apr 2023 00:18:58 +0000 (09:18 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 14 Apr 2023 00:18:58 +0000 (09:18 +0900)
[   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 [new file with mode: 0644]
packaging/rust-arrayvec.spec

diff --git a/packaging/matches_extern.patch b/packaging/matches_extern.patch
new file mode 100644 (file)
index 0000000..b302692
--- /dev/null
@@ -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;
index 03c3e19..be92f9d 100644 (file)
@@ -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