Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 May 2011 19:36:07 +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: r222379 - head/tools/regression/bin/sh/builtins
Message-ID:  <201105271936.p4RJa7Qs049683@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Fri May 27 19:36:07 2011
New Revision: 222379
URL: http://svn.freebsd.org/changeset/base/222379

Log:
  sh: Add simple CDPATH test.

Added:
  head/tools/regression/bin/sh/builtins/cd5.0   (contents, props changed)

Added: head/tools/regression/bin/sh/builtins/cd5.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/cd5.0	Fri May 27 19:36:07 2011	(r222379)
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+set -e
+T=$(mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXX")
+trap 'rm -rf "$T"' 0
+
+cd -P "$T"
+D=$(pwd)
+
+mkdir a a/1 b b/1 b/2
+
+CDPATH=$D/a:
+# Basic test.
+cd 1 >/dev/null
+[ "$(pwd)" = "$D/a/1" ]
+# Test that the current directory is not checked before CDPATH.
+cd "$D/b"
+cd 1 >/dev/null
+[ "$(pwd)" = "$D/a/1" ]
+# Test not using a CDPATH entry.
+cd "$D/b"
+cd 2
+[ "$(pwd)" = "$D/b/2" ]



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