From 8fbad1c37450b196e7a9a4c2a1149c768c8dca31 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 15 May 2023 10:58:19 +0900 Subject: [PATCH] Add unittest [ 55s] + ./convert_case [ 55s] [ 55s] running 41 tests [ 55s] test case::test::all_cases_in_iter ... ok [ 55s] test converter::test::add_boundaries ... ok [ 55s] test converter::test::add_boundary ... ok [ 55s] test converter::test::custom_delim ... ok [ 55s] test converter::test::custom_pattern ... ok [ 55s] test converter::test::no_delim ... ok [ 55s] test converter::test::explicit_boundaries ... ok [ 55s] test converter::test::no_digit_boundaries ... ok [ 55s] test converter::test::no_pattern ... ok [ 55s] test converter::test::remove_boundary ... ok [ 55s] test pattern::test::mutate_empty_strings ... ok [ 55s] test converter::test::reuse_after_change ... ok [ 55s] test converter::test::snake_converter_from_case ... ok [ 55s] test converter::test::snake_converter_from_scratch ... ok [ 55s] test pattern::test::pseudo_no_triples ... ok [ 55s] test pattern::test::randoms_are_random ... ok [ 55s] test segmentation::test::all_boundaries_in_iter ... ok [ 55s] test segmentation::test::boundaries_found_in_string ... ok [ 55s] test segmentation::test::split_on_delims ... ok [ 55s] test test::accent_mark ... ok [ 55s] test test::alternating_ignore_symbols ... ok [ 55s] test test::camel_case_acroynms ... ok [ 55s] test test::default_all_boundaries ... ok [ 55s] test test::double_delimeters ... ok [ 55s] test test::detect_many_cases ... ok [ 55s] test test::early_word_boundaries ... ok [ 55s] test test::empty_string ... ok [ 55s] test test::late_word_boundaries ... ok [ 55s] test test::leading_tailing_delimeters ... ok [ 55s] test test::multiline_strings ... ok [ 55s] test test::multiple_from_case ... ok [ 55s] test test::obvious_default_parsing ... ok [ 55s] test test::owned_string ... ok [ 55s] test test::random_case_boundaries ... ok [ 55s] test test::lossless_against_lossless ... ok [ 55s] test test::detect_each_case ... ok [ 55s] test test::remove_boundaries ... ok [ 55s] test test::russian ... ok [ 55s] test test::string_is_kebab ... ok [ 55s] test test::string_is_snake ... ok [ 55s] test test::with_boundaries ... ok [ 55s] [ 55s] test result: ok. 41 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s --- packaging/rust-convert_case.spec | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/packaging/rust-convert_case.spec b/packaging/rust-convert_case.spec index bb32fb8..ec92a97 100644 --- a/packaging/rust-convert_case.spec +++ b/packaging/rust-convert_case.spec @@ -29,9 +29,10 @@ Requires: rust-unicode-segmentation # ========================================================== # dev-dependencies # ========================================================== -# BuildRequires: rust-strum -# BuildRequires: rust-strum_macros - +%if 0%{?run_tests} +BuildRequires: rust-strum +BuildRequires: rust-strum_macros +%endif %description Convert strings into any case. @@ -60,6 +61,20 @@ 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}} \ + --cfg='feature="random"' \ + %rust_dylib_extern rand \ + %rust_dylib_extern unicode_segmentation \ + %rust_dylib_extern strum \ + %rust_dylib_extern strum_macros \ + ./src/lib.rs + +./%{real_crate_name} +%endif %clean %post -p /sbin/ldconfig -- 2.7.4