1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

test/expr: add regex tests

This commit is contained in:
Roy Ivy III 2022-12-28 03:20:41 -06:00
parent 8753fb95c3
commit 737271de96

View file

@ -1,4 +1,4 @@
// spell-checker:ignore αbcdef // spell-checker:ignore αbcdef ; (people) kkos
use crate::common::util::*; use crate::common::util::*;
@ -179,6 +179,27 @@ fn test_length_mb() {
.stdout_only("6\n"); .stdout_only("6\n");
} }
#[test]
fn test_regex() {
// FixME: [2022-12-19; rivy] test disabled as it currently fails due to 'oniguruma' bug (see GH:kkos/oniguruma/issues/279)
// new_ucmd!()
// .args(&["a^b", ":", "a^b"])
// .succeeds()
// .stdout_only("3\n");
new_ucmd!()
.args(&["a^b", ":", "a\\^b"])
.succeeds()
.stdout_only("3\n");
new_ucmd!()
.args(&["a$b", ":", "a\\$b"])
.succeeds()
.stdout_only("3\n");
new_ucmd!()
.args(&["-5", ":", "-\\{0,1\\}[0-9]*$"])
.succeeds()
.stdout_only("2\n");
}
#[test] #[test]
fn test_substr() { fn test_substr() {
new_ucmd!() new_ucmd!()