From 747bb8c9da03060da94c2116e50b04e7ccaac4f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Tue, 15 Oct 1996 06:03:35 +0200
Subject: [PATCH] more tests added

Rev: src/modules/sprintf/testsuite.in:1.7
Rev: src/testsuite.in:1.5
---
 src/modules/sprintf/testsuite.in |  4 ++++
 src/testsuite.in                 | 27 +++++++++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/modules/sprintf/testsuite.in b/src/modules/sprintf/testsuite.in
index 677322b3be..db14290640 100644
--- a/src/modules/sprintf/testsuite.in
+++ b/src/modules/sprintf/testsuite.in
@@ -48,8 +48,12 @@ test_eq(sprintf("%'FOO'10s","BAR"),"FOOFOOFBAR")
 test_eq(sprintf("%d %<d %<d",2),"2 2 2")
 test_true(stringp(sprintf("%O",({1,2,"foo"}))))
 test_true(stringp(sprintf("%O",([1:2,"foo":"bar"]))))
+test_eq(strlen(sprintf("%@c",allocate(1000))),1000)
 
 test_eq(sprintf("test \0 \n"),"test \0 \n")
+test_eq(sprintf("test \0"),"test \0")
+test_eq(sprintf("%~*n","f",5),"fffff")
+test_eq(sprintf("%'\000'*n",5),"\000\000\000\000\000")
 
 dnl . : and ; hasn't been tested
 dnl ^, @ and _ hasn't been tested yet
diff --git a/src/testsuite.in b/src/testsuite.in
index 1d9d029b82..a2e3410a33 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -40,14 +40,6 @@ cond([[all_efuns()->localtime]],
 test_true(mappingp(localtime(0)))
 ]])
 
-// strerror
-cond([[all_efuns()->strerror]],
-[[
-test_do(strerror(1))
-test_true(stringp(strerror(2)||""))
-]])
-
-
 // sort
 test_equal(sort(({1,3,2,4})),({1,2,3,4}))
 test_equal(sort(({4,3,2,1})),({1,2,3,4}))
@@ -78,6 +70,23 @@ return 0;
   test_true(objectp(clone(Queue)))
 ]])
 
+test_any([[
+#include <getopt.h>
+return 0;
+]],0)
+
+  test_true(find_option(({"","--foo"}),"p","foo"))
+  test_eq(find_option(({"","--foo=bar"}),"p","foo",0,0),"bar")
+  test_eq(find_option(({"","--foo","bar"}),"p","foo",0,0),"bar")
+  test_eq(find_option(({"","--","--foo=bar"}),"p","foo",0,0),0)
+
+  test_true(find_option(({"","-p"}),"p","foo"))
+  test_eq(find_option(({"","-pbar"}),"p","foo",0,0),"bar")
+  test_eq(find_option(({"","-p","bar"}),"p","foo",0,0),"bar")
+  test_eq(find_option(({"","--","--p","bar"}),"p","foo",0,0),0)
+
+  test_equal(get_args(({"",0,0,"sune","--","-foo"})),({"","sune","-foo"}))
+
 test_any([[
 #include <string.h>
 return 0;
@@ -90,6 +99,8 @@ return 0;
   test_eq((string)Flurp,"testtest")
   test_do(add_constant("Flurp"))
 
+  test_eq(strmult("foo",4),"foofoofoofoo")
+
 // m_delete
 test_equal(([1:1]),m_delete(a(),0))
 test_equal(([1:1]),m_delete(([1:1,0:3]),0))
-- 
GitLab