From 57c3248d6df27500aec0e5cd58a23b46c5d0b507 Mon Sep 17 00:00:00 2001 From: Pro Date: Mon, 2 Sep 2024 20:49:23 +0200 Subject: [PATCH] Add test for slices of strings --- tests/marshalling.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/marshalling.rs b/tests/marshalling.rs index f5be7520..b4d844a0 100644 --- a/tests/marshalling.rs +++ b/tests/marshalling.rs @@ -1,7 +1,7 @@ //! Contains all tests that cover marshalling types to and from C++ use opencv::core; -use opencv::core::{Scalar, SparseMat, Tuple}; +use opencv::core::{CommandLineParser, Scalar, SparseMat, Tuple}; use opencv::prelude::*; use opencv::Result; @@ -273,3 +273,12 @@ fn tuple() -> Result<()> { // assert_eq!(mat.data_typed()?, mat_src.data_typed()?); // Ok(()) // } + +#[test] +fn string_array() -> Result<()> { + let args = ["test", "-a=b"]; + let mut parser = CommandLineParser::new(i32::try_from(args.len())?, &args, "{a | | }")?; + assert!(parser.has("a")?); + assert_eq!("b", parser.get_str("a", true)?); + Ok(()) +}