From 7525ace3a35ddf08e3dd021004adec1dea77ef67 Mon Sep 17 00:00:00 2001
From: Sehrope Sarkuni <sehrope@jackdb.com>
Date: Sat, 29 Aug 2026 13:55:44 +0000
Subject: [PATCH 4/4] Test getopt_long() with a non-option before a missing
 argument

---
 .../test_getopt_long/t/001_getopt_long.pl     | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/test/modules/test_getopt_long/t/001_getopt_long.pl b/src/test/modules/test_getopt_long/t/001_getopt_long.pl
index 85c49d7d678..b407967a148 100644
--- a/src/test/modules/test_getopt_long/t/001_getopt_long.pl
+++ b/src/test/modules/test_getopt_long/t/001_getopt_long.pl
@@ -75,6 +75,18 @@ args: -ab
 --
 stderr: requires an argument -- '?b'?
 
+== short missing arg, non-option before
+args: foo -b
+?
+-- foo
+stderr: requires an argument -- '?b'?
+
+== short missing arg, lone dash before
+args: - -b
+?
+-- -
+stderr: requires an argument -- '?b'?
+
 == short unknown
 args: -x
 ?
@@ -184,6 +196,18 @@ args: -a --beta
 --
 stderr: requires an argument -- beta|[`']--beta' requires an argument
 
+== long required, missing, non-option before
+args: foo --beta
+?
+-- foo
+stderr: requires an argument -- beta|[`']--beta' requires an argument
+
+== long required, missing, lone dash before
+args: - --beta
+?
+-- -
+stderr: requires an argument -- beta|[`']--beta' requires an argument
+
 == long optional, alone
 args: --gamma
 --gamma
-- 
2.17.1

