From c69239258dca5e98a0c11947c9ab7da169d88c63 Mon Sep 17 00:00:00 2001
From: Ray Gardner <raygard@gmail.com>
Date: Tue, 1 Oct 2024 17:50:25 -0600
Subject: [PATCH 5/7] Update awk.test

Add tests for split() via an empty regex string and empty regex literal..
---
 tests/awk.test | 5 +++++

diff --git a/tests/awk.test b/tests/awk.test
index f624fdc..d94b81e 100644
--- a/tests/awk.test
+++ b/tests/awk.test
@@ -420,6 +420,11 @@ testcmd "awk -v myvar=val -f file1 file" "-v myvar=$2 -f test.awk testfile1.txt
 
 # 2024: New tests -- not in Divya Kothari's original ...
 
+# The following has never had a problem but is a good test anyway
+testcmd "split on empty string" "'BEGIN { n = split(\"abc\", a, \"\");print n, length(a)}'" "3 3\n" "" ""
+# The following must be run with ASAN=1 to cause failure with older versions
+testcmd "split on empty regex" "'BEGIN { n = split(\"abc\", a, //);print n, length(a)}'" "3 3\n" "" ""
+
 testcmd "srand() seeds unix time seconds" "'{dt = srand(srand()) - \$0; ok = dt == 0 || dt == 1; print ok}'" "1\n" "" "`date +%s`"
 testcmd "srand() default seed is 1" "'BEGIN{ print srand()}'" "1\n" "" ""
 
-- 
2.43.0

