separate has_shebang_line tests
This commit is contained in:
parent
edda2a0e90
commit
72ea60bb8d
1
tests/Internals/bash
Executable file
1
tests/Internals/bash
Executable file
@ -0,0 +1 @@
|
|||||||
|
run '!#/bin/bash'
|
1
tests/Internals/empty
Executable file
1
tests/Internals/empty
Executable file
@ -0,0 +1 @@
|
|||||||
|
! run ''
|
5
tests/Internals/empty-line
Executable file
5
tests/Internals/empty-line
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
! run '
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'
|
1
tests/Internals/env
Executable file
1
tests/Internals/env
Executable file
@ -0,0 +1 @@
|
|||||||
|
run '!#/usr/bin/env true'
|
@ -1,20 +0,0 @@
|
|||||||
TESTING_URCHIN_INTERNALS=true . ../../urchin
|
|
||||||
|
|
||||||
echo '!#/bin/sh' > $tmp
|
|
||||||
! has_shebang_line $tmp
|
|
||||||
|
|
||||||
echo '!#/bin/bash' > $tmp
|
|
||||||
has_shebang_line $tmp
|
|
||||||
|
|
||||||
echo '!#/usr/bin/env true' > $tmp
|
|
||||||
has_shebang_line $tmp
|
|
||||||
|
|
||||||
echo > $tmp
|
|
||||||
! has_shebang_line $tmp
|
|
||||||
|
|
||||||
echo '
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
' > $tmp
|
|
||||||
! has_shebang_line $tmp
|
|
@ -1 +1,7 @@
|
|||||||
export tmp=$(mktemp)
|
export tmp=$(mktemp)
|
||||||
|
|
||||||
|
run() {
|
||||||
|
TESTING_URCHIN_INTERNALS=true . ../../urchin
|
||||||
|
echo "$1" > $tmp
|
||||||
|
has_shebang_line $tmp
|
||||||
|
}
|
||||||
|
1
tests/Internals/sh
Executable file
1
tests/Internals/sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
! run '!#/bin/sh'
|
2
urchin
2
urchin
@ -414,7 +414,7 @@ report_outcome() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
has_shebang_line() {
|
has_shebang_line() {
|
||||||
head -n 1 "${1}" | grep -q -v '^#!/bin/sh'
|
head -n 1 "${1}" | grep -v '^#!/bin/sh$' | grep -q '^#!'
|
||||||
}
|
}
|
||||||
|
|
||||||
USAGE="usage: $0 [options]... [test file or directory]..."
|
USAGE="usage: $0 [options]... [test file or directory]..."
|
||||||
|
Loading…
Reference in New Issue
Block a user