Add a test for "$@" generating $# of 0 into a shell function.

This commit is contained in:
dsl 2006-11-17 22:25:46 +00:00
parent 55b9633384
commit cbcdf48a7e

View File

@ -1,5 +1,5 @@
#! /bin/sh
# $NetBSD: expand.sh,v 1.2 2006/11/09 12:17:35 rillig Exp $
# $NetBSD: expand.sh,v 1.3 2006/11/17 22:25:46 dsl Exp $
#
#
@ -28,6 +28,11 @@ set -- "" "" # This code triggered the bug.
got=`echo "$@" | sed 's,$,EOL,'`
assert_equals "2" " EOL" "$got"
set -- -
shift
n_arg() { echo $#; }
assert_equals "3" "0" `n_arg "$@"`
line='#define bindir "/usr/bin" /* comment */'
stripped='#define bindir "/usr/bin" '
assert_equals "3" "$stripped" "${line%%/\**}"