Skip to content

Commit 79d0fb0

Browse files
committed
check_sketch_structure: Add unit tests for all output
1 parent 6609833 commit 79d0fb0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/check_sketch_structure.bats

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source ../arduino-ci-script.sh
88
echo "Exit status: $status | Expected: $expectedExitStatus"
99
[ "$status" -eq $expectedExitStatus ]
1010
[ "${#lines[@]}" -eq 1 ]
11-
outputRegex='^'
11+
outputRegex="^ERROR: Specified folder: \./check_library_structure/DoesntExist doesn't exist\.$"
1212
[[ "${lines[0]}" =~ $outputRegex ]]
1313
}
1414

@@ -18,7 +18,7 @@ source ../arduino-ci-script.sh
1818
echo "Exit status: $status | Expected: $expectedExitStatus"
1919
[ "$status" -eq $expectedExitStatus ]
2020
[ "${#lines[@]}" -eq 1 ]
21-
outputRegex='^'
21+
outputRegex="^WARNING: File \./check_library_structure/PdeSketchExtension/examples/example1/foo\.pde uses the \.pde extension\. For Arduino sketches, it's recommended to use the \.ino extension instead\. If this is a Processing sketch then \.pde is the correct extension\.$"
2222
[[ "${lines[0]}" =~ $outputRegex ]]
2323
}
2424

@@ -28,7 +28,7 @@ source ../arduino-ci-script.sh
2828
echo "Exit status: $status | Expected: $expectedExitStatus"
2929
[ "$status" -eq $expectedExitStatus ]
3030
[ "${#lines[@]}" -eq 1 ]
31-
outputRegex='^'
31+
outputRegex='^ERROR: Sketch file ./check_library_structure/IncorrectSketchExtensionCase/examples/example1/example1\.Ino has incorrect extension case, which causes it to not be recognized on a filename case-sensitive OS such as Linux\.$'
3232
[[ "${lines[0]}" =~ $outputRegex ]]
3333
}
3434

@@ -38,7 +38,7 @@ source ../arduino-ci-script.sh
3838
echo "Exit status: $status | Expected: $expectedExitStatus"
3939
[ "$status" -eq $expectedExitStatus ]
4040
[ "${#lines[@]}" -eq 1 ]
41-
outputRegex='^'
41+
outputRegex='^WARNING: Discouraged folder name: 1example1\. Folder name beginning with a number is only supported by Arduino IDE 1\.8\.4 and newer\.$'
4242
[[ "${lines[0]}" =~ $outputRegex ]]
4343
}
4444

@@ -48,7 +48,7 @@ source ../arduino-ci-script.sh
4848
echo "Exit status: $status | Expected: $expectedExitStatus"
4949
[ "$status" -eq $expectedExitStatus ]
5050
[ "${#lines[@]}" -eq 1 ]
51-
outputRegex='^'
51+
outputRegex='^ERROR: Invalid folder name: -example1\. Folder name beginning with a - or \. is not allowed\.$'
5252
[[ "${lines[0]}" =~ $outputRegex ]]
5353
}
5454

@@ -58,7 +58,7 @@ source ../arduino-ci-script.sh
5858
echo "Exit status: $status | Expected: $expectedExitStatus"
5959
[ "$status" -eq $expectedExitStatus ]
6060
[ "${#lines[@]}" -eq 1 ]
61-
outputRegex='^'
61+
outputRegex='^ERROR: Invalid folder name: example 1\. Only letters, numbers, dots, dashes, and underscores are allowed\.$'
6262
[[ "${lines[0]}" =~ $outputRegex ]]
6363
}
6464

@@ -68,7 +68,7 @@ source ../arduino-ci-script.sh
6868
echo "Exit status: $status | Expected: $expectedExitStatus"
6969
[ "$status" -eq $expectedExitStatus ]
7070
[ "${#lines[@]}" -eq 1 ]
71-
outputRegex='^ERROR: Folder name asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf exceeds the maximum of 63 characters\.'
71+
outputRegex='^ERROR: Folder name asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf exceeds the maximum of 63 characters\.$'
7272
[[ "${lines[0]}" =~ $outputRegex ]]
7373
}
7474

@@ -78,7 +78,7 @@ source ../arduino-ci-script.sh
7878
echo "Exit status: $status | Expected: $expectedExitStatus"
7979
[ "$status" -eq $expectedExitStatus ]
8080
[ "${#lines[@]}" -eq 1 ]
81-
outputRegex='^ERROR: Folder name asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf exceeds the maximum of 63 characters\.'
81+
outputRegex='^ERROR: Folder name asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf exceeds the maximum of 63 characters\.$'
8282
[[ "${lines[0]}" =~ $outputRegex ]]
8383
}
8484

@@ -88,7 +88,7 @@ source ../arduino-ci-script.sh
8888
echo "Exit status: $status | Expected: $expectedExitStatus"
8989
[ "$status" -eq $expectedExitStatus ]
9090
[ "${#lines[@]}" -eq 1 ]
91-
outputRegex='^ERROR: Sketch folder name \./check_library_structure/SketchFolderNameMismatch/examples/example1 does not match the sketch filename\.'
91+
outputRegex='^ERROR: Sketch folder name \./check_library_structure/SketchFolderNameMismatch/examples/example1 does not match the sketch filename\.$'
9292
[[ "${lines[0]}" =~ $outputRegex ]]
9393
}
9494

@@ -98,7 +98,7 @@ source ../arduino-ci-script.sh
9898
echo "Exit status: $status | Expected: $expectedExitStatus"
9999
[ "$status" -eq $expectedExitStatus ]
100100
[ "${#lines[@]}" -eq 1 ]
101-
outputRegex='^ERROR: Multiple sketches found in the same folder \(\./check_library_structure/MultipleSketchesInSameFolderUnix/examples/example1\)\.'
101+
outputRegex='^ERROR: Multiple sketches found in the same folder \(\./check_library_structure/MultipleSketchesInSameFolderUnix/examples/example1\)\.$'
102102
[[ "${lines[0]}" =~ $outputRegex ]]
103103
}
104104

@@ -108,6 +108,6 @@ source ../arduino-ci-script.sh
108108
echo "Exit status: $status | Expected: $expectedExitStatus"
109109
[ "$status" -eq $expectedExitStatus ]
110110
[ "${#lines[@]}" -eq 1 ]
111-
outputRegex='^ERROR: Multiple sketches found in the same folder \(\./check_library_structure/MultipleSketchesInSameFolderMac/examples/example1\)\.'
111+
outputRegex='^ERROR: Multiple sketches found in the same folder \(\./check_library_structure/MultipleSketchesInSameFolderMac/examples/example1\)\.$'
112112
[[ "${lines[0]}" =~ $outputRegex ]]
113113
}

0 commit comments

Comments
 (0)