Add unittest
authorRoy7Kim <myoungwoon.kim@samsung.com>
Thu, 25 May 2023 00:58:57 +0000 (09:58 +0900)
committerRoy7Kim <myoungwoon.kim@samsung.com>
Thu, 25 May 2023 00:59:41 +0000 (09:59 +0900)
[   23s] + ./mime
[   23s]
[   23s] running 14 tests
[   23s] test parse::test_lookup_tables ... ok
[   23s] test test_mimes_macro_consts ... ok
[   23s] test test_names_macro_consts ... ok
[   23s] test tests::test_essence_str ... ok
[   23s] test tests::test_case_sensitive_values ... ok
[   23s] test tests::test_get_param ... ok
[   23s] test tests::test_matching ... ok
[   23s] test tests::test_mime_fmt ... ok
[   23s] test tests::test_mime_from_str_empty_parameter_list ... ok
[   23s] test tests::test_name_eq ... ok
[   23s] test tests::test_mime_from_str ... ok
[   23s] test tests::test_subtype ... ok
[   23s] test tests::test_type_ ... ok
[   23s] test tests::test_suffix ... ok
[   23s]
[   23s] test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

packaging/rust-mime.spec

index 9355578..d719eb6 100644 (file)
@@ -37,17 +37,27 @@ cp %{SOURCE1} .
 # crate-type : dylib, proc-macro, cdylib, bin, etc.
 # ==========================================================
 %build
- %{rustc_std_build} --crate-type=dylib \
-         --crate-name=%{real_crate_name} \
-         %{?rustc_edition:--edition=%{rustc_edition}} \
-         ./src/lib.rs
+%{rustc_std_build} --crate-type=dylib \
+        --crate-name=%{real_crate_name} \
+        %{?rustc_edition:--edition=%{rustc_edition}} \
+        ./src/lib.rs
 
 # ==========================================================
 # install section
 # ==========================================================
 %install
- install -d -m 0755 %{buildroot}%{_rust_dylibdir}
- install -m 0644 lib%{real_crate_name}.so %{buildroot}/%{_rust_dylibdir}/lib%{real_crate_name}.so
+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}} \
+        ./src/lib.rs
+
+./%{real_crate_name}
+%endif
 
 %clean
 
@@ -60,6 +70,6 @@ cp %{SOURCE1} .
 # ==========================================================
 %files
 %manifest %{name}.manifest
- %license LICENSE-APACHE
- %license LICENSE-MIT
- %{_rust_dylibdir}/lib%{real_crate_name}.so
+%license LICENSE-APACHE
+%license LICENSE-MIT
+%{_rust_dylibdir}/lib%{real_crate_name}.so