Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Mar 2015 22:00:25 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r280830 - head/tools/regression/lib/libc/gen
Message-ID:  <201503292200.t2TM0Png059419@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Mar 29 22:00:24 2015
New Revision: 280830
URL: https://svnweb.freebsd.org/changeset/base/280830

Log:
  wordexp(): Add testcase for non-default IFS in environment.
  
  The non-default IFS is expected to be used.
  
  MFC after:	1 week

Modified:
  head/tools/regression/lib/libc/gen/test-wordexp.c

Modified: head/tools/regression/lib/libc/gen/test-wordexp.c
==============================================================================
--- head/tools/regression/lib/libc/gen/test-wordexp.c	Sun Mar 29 21:53:08 2015	(r280829)
+++ head/tools/regression/lib/libc/gen/test-wordexp.c	Sun Mar 29 22:00:24 2015	(r280830)
@@ -240,6 +240,21 @@ main(int argc, char *argv[])
 	r = unsetenv("IFS");
 	assert(r == 0);
 
+	/*
+	 * With IFS set to a non-default value, and using it.
+	 */
+	r = setenv("IFS", ":", 1);
+	assert(r == 0);
+	r = wordexp("${IFS+hello:world}", &we, 0);
+	assert(r == 0);
+	assert(we.we_wordc == 2);
+	assert(strcmp(we.we_wordv[0], "hello") == 0);
+	assert(strcmp(we.we_wordv[1], "world") == 0);
+	assert(we.we_wordv[2] == NULL);
+	wordfree(&we);
+	r = unsetenv("IFS");
+	assert(r == 0);
+
 	printf("PASS wordexp()\n");
 	printf("PASS wordfree()\n");
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503292200.t2TM0Png059419>