test/expr: add regex tests

This commit is contained in:
Roy Ivy III
2022-12-29 23:22:13 -06:00
parent 8753fb95c3
commit 737271de96
+22 -1
View File
@@ -1,4 +1,4 @@
// spell-checker:ignore αbcdef
// spell-checker:ignore αbcdef ; (people) kkos
use crate::common::util::*;
@@ -179,6 +179,27 @@ fn test_length_mb() {
.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]
fn test_substr() {
new_ucmd!()