-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the structure of the temporary files
- Loading branch information
Showing
14 changed files
with
89 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#shellcheck shell=sh disable=SC2004 | ||
|
||
count_specfiles() { | ||
eval "$1=0; found_specfile() { $1=\$((\$$1 + 1)); }" | ||
shift | ||
eval find_specfiles found_specfile ${1+'"$@"'} | ||
} | ||
|
||
create_workdirs() { | ||
i=0 | ||
while [ "$i" -lt "$1" ] && i=$(($i + 1)); do | ||
set -- "$@" "$SHELLSPEC_TMPBASE/$i" | ||
done | ||
shift | ||
[ $# -eq 0 ] || mkdir "$@" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#shellcheck shell=sh | ||
|
||
Describe "libexec/executor.sh" | ||
Include "$SHELLSPEC_LIB/libexec/executor.sh" | ||
|
||
Describe "count_specfiles()" | ||
Before count='' | ||
|
||
find_specfiles() { | ||
_callback=$1 && shift | ||
while [ $# -gt 0 ]; do "$_callback"; shift ; done | ||
} | ||
|
||
It 'counts specfiles' | ||
When call count_specfiles count file1 file3 file3 | ||
The variable count should eq 3 | ||
End | ||
End | ||
|
||
Describe "create_workdirs()" | ||
mkdir() { printf '%s\n' "$@"; } | ||
|
||
It 'creates workdirs' | ||
When call create_workdirs 5 | ||
The line 1 of stdout should eq "$SHELLSPEC_TMPBASE/1" | ||
The line 2 of stdout should eq "$SHELLSPEC_TMPBASE/2" | ||
The line 3 of stdout should eq "$SHELLSPEC_TMPBASE/3" | ||
The line 4 of stdout should eq "$SHELLSPEC_TMPBASE/4" | ||
The line 5 of stdout should eq "$SHELLSPEC_TMPBASE/5" | ||
End | ||
End | ||
End |