Skip to content

Commit ba12165

Browse files
committed
build: bump package version to v1.0.0
1 parent 7a4a2fa commit ba12165

File tree

4 files changed

+55
-25
lines changed

4 files changed

+55
-25
lines changed

nix/package.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
modules = ../go/gomod2nix.toml;
55
pname = "snekcheck";
66
src = ../go;
7-
version = "0.0";
7+
version = "1.0.0";
88
};
99
in {
1010
apps.snekcheck.program = "${pkg}/bin/snekcheck";

spec/check_spec.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ Describe "check"
1313

1414
Context "with no subdirectories"
1515
create_valid_files() { for _ in $(seq 1 "$1"); do create_valid_file "$root"; done; }
16-
BeforeEach "create_valid_files 20"
16+
BeforeEach "create_valid_files 10 > /dev/null"
1717

1818
It "succeeds"
1919
When call "$bin" "$root"
2020
The status should be success
21-
The output should include "21 valid filenames"
21+
The output should include "11 valid filenames"
2222
The output should include "0 invalid filenames"
2323
The length of error should equal 0
2424
End
2525

2626
Context "and one invalid file"
27-
BeforeEach "create_invalid_file $root"
27+
BeforeEach "create_invalid_file $root > /dev/null"
2828

2929
It "fails"
3030
When call "$bin" "$root"
3131
The status should be failure
32-
The output should include "21 valid filenames"
32+
The output should include "11 valid filenames"
3333
The output should include "1 invalid filenames"
3434
The error should include "invalid filenames found"
3535
End
@@ -44,12 +44,12 @@ Describe "check"
4444
End
4545

4646
Context "and one invalid directory"
47-
BeforeEach "create_invalid_file $root"
47+
BeforeEach "create_invalid_file $root > /dev/null"
4848

4949
It "fails"
5050
When call "$bin" "$root"
5151
The status should be failure
52-
The output should include "21 valid filenames"
52+
The output should include "11 valid filenames"
5353
The output should include "1 invalid filenames"
5454
The error should include "invalid filenames found"
5555
End
@@ -66,19 +66,19 @@ Describe "check"
6666

6767
Context "with many subdirectories"
6868
create_valid_files() { for _ in $(seq 1 "$1"); do create_valid_file "$2"; done; }
69-
BeforeEach "create_valid_files 20 $root"
69+
BeforeEach "create_valid_files 10 $root > /dev/null"
7070
create_valid_directories() {
7171
for _ in $(seq 1 "$1"); do
7272
dir=$(create_valid_directory "$root")
7373
create_valid_files "$1" "$dir"
7474
done
7575
}
76-
BeforeEach "create_valid_directories 20"
76+
BeforeEach "create_valid_directories 10 > /dev/null"
7777

7878
It "succeeds"
7979
When call "$bin" "$root"
8080
The status should be success
81-
The output should include "441 valid filenames"
81+
The output should include "121 valid filenames"
8282
The output should include "0 invalid filenames"
8383
The length of error should equal 0
8484
End

spec/fix_spec.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ Describe "fix"
1313

1414
Context "with no subdirectories"
1515
create_valid_files() { for _ in $(seq 1 "$1"); do create_valid_file "$root"; done; }
16-
BeforeEach "create_valid_files 20"
16+
BeforeEach "create_valid_files 10 > /dev/null"
1717

1818
It "succeeds"
1919
When call "$bin" --fix "$root"
2020
The status should be success
21-
The output should include "21 valid filenames"
21+
The output should include "11 valid filenames"
2222
The output should include "0 filenames changed"
2323
The length of error should equal 0
2424
End
2525

2626
Context "and one invalid file"
2727
create_and_assign_invalid_file() { invalid=$(create_invalid_file "$root"); }
28-
BeforeEach "create_and_assign_invalid_file"
28+
BeforeEach "create_and_assign_invalid_file > /dev/null"
2929

3030
It "succeeds given the root"
3131
When call "$bin" --fix "$root"
@@ -75,7 +75,7 @@ Describe "fix"
7575

7676
Context "and one invalid directory"
7777
create_and_assign_invalid_directory() { invalid=$(create_invalid_directory "$root"); }
78-
BeforeEach "create_and_assign_invalid_directory"
78+
BeforeEach "create_and_assign_invalid_directory > /dev/null"
7979

8080
It "succeeds given the root"
8181
When call "$bin" --fix "$root"
@@ -126,14 +126,14 @@ Describe "fix"
126126

127127
Context "with many subdirectories"
128128
create_valid_files() { for _ in $(seq 1 "$1"); do create_valid_file "$2"; done; }
129-
BeforeEach "create_valid_files 20 $root"
129+
BeforeEach "create_valid_files 10 $root > /dev/null"
130130
create_valid_directories() {
131131
for _ in $(seq 1 "$1"); do
132132
dir=$(create_valid_directory "$root")
133133
create_valid_files "$1" "$dir"
134134
done
135135
}
136-
BeforeEach "create_valid_directories 20"
136+
BeforeEach "create_valid_directories 10 > /dev/null"
137137

138138
It "succeeds"
139139
When call "$bin" --fix "$root"

spec/spec_helper.sh

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,52 @@ bin="./result/bin/snekcheck"
55

66
create_valid_directory() {
77
dir_name=$(echo "$RANDOM" | md5sum | head -c 20)
8-
mkdir --parents "$1"/"$dir_name"
9-
echo "$1"/"$dir_name"
8+
dir_path="$1/$dir_name"
9+
10+
if [ -d "$dir_path" ]; then
11+
create_valid_directory "$1"
12+
else
13+
mkdir --parents "$dir_path"
14+
echo "$dir_path"
15+
fi
1016
}
17+
1118
create_valid_file() {
1219
file_name=$(echo "$RANDOM" | md5sum | head -c 20)
13-
mkdir --parents "$1"
14-
touch "$1"/"$file_name"
15-
echo "$1"/"$file_name"
20+
file_path="$1/$file_name"
21+
22+
if [ -e "$file_path" ]; then
23+
create_valid_file "$1"
24+
else
25+
mkdir --parents "$1"
26+
touch "$file_path"
27+
echo "$file_path"
28+
fi
1629
}
30+
1731
create_invalid_directory() {
18-
mkdir --parents "$1"
19-
mktemp --directory --tmpdir="$1" --quiet XXXInVaLiDXXX
32+
dir_name=$(echo "$RANDOM" | md5sum | head -c 20)InVaLiD
33+
dir_path="$1/$dir_name"
34+
35+
if [ -d "$dir_path" ]; then
36+
create_valid_directory "$1"
37+
else
38+
mkdir --parents "$dir_path"
39+
echo "$dir_path"
40+
fi
2041
}
42+
2143
create_invalid_file() {
22-
mkdir --parents "$1"
23-
mktemp --tmpdir="$1" --quiet XXXInVaLiDXXX
44+
file_name=$(echo "$RANDOM" | md5sum | head -c 20)InVaLiD
45+
file_path="$1/$file_name"
46+
47+
if [ -e "$file_path" ]; then
48+
create_valid_file "$1"
49+
else
50+
mkdir --parents "$1"
51+
touch "$file_path"
52+
echo "$file_path"
53+
fi
2454
}
2555

2656
spec_helper_precheck() {

0 commit comments

Comments
 (0)