test: Use script file for sed basename test.

As of this commit, Gash does not process the quotes around the script
properly, and ends up calling sed with no arguments.
This commit is contained in:
Timothy Sample 2018-12-09 15:53:01 -05:00
parent 8c5a9ea96f
commit cb8b2758e0
2 changed files with 14 additions and 15 deletions

View File

@ -1,15 +1 @@
basename='/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
echo 'X/foo/bar' | \sed "$basename"
echo 'X/foo/bar' | \sed -f test/data/basename.sed

13
test/data/basename.sed Normal file
View File

@ -0,0 +1,13 @@
/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q