Skip to content

Commit c7639d0

Browse files
committed
check_library_manager_compliance: Add unit tests for all output
1 parent 8ef8d41 commit c7639d0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/check_library_manager_compliance.bats

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ TESTS_BATS_APPLICATION_FOLDER="$APPLICATION_FOLDER"
3333
echo "Exit status: $status | Expected: $expectedExitStatus"
3434
[ "$status" -eq $expectedExitStatus ]
3535
[ "${#lines[@]}" -eq 1 ]
36+
outputRegex="^ERROR: Specified folder: \./check_library_manager_compliance/DoesntExist doesn't exist\.$"
37+
[[ "${lines[0]}" =~ $outputRegex ]]
3638
}
3739

3840
@test "check_library_manager_compliance \"./check_library_manager_compliance/ContainsExe\"" {
@@ -41,6 +43,8 @@ TESTS_BATS_APPLICATION_FOLDER="$APPLICATION_FOLDER"
4143
echo "Exit status: $status | Expected: $expectedExitStatus"
4244
[ "$status" -eq $expectedExitStatus ]
4345
[ "${#lines[@]}" -eq 1 ]
46+
outputRegex='^ERROR: \.exe file found at \./check_library_manager_compliance/ContainsExe/asdf\.exe$'
47+
[[ "${lines[0]}" =~ $outputRegex ]]
4448
}
4549

4650
@test "check_library_manager_compliance \"./check_library_manager_compliance/ContainsDotDevelopment\"" {
@@ -49,6 +53,8 @@ TESTS_BATS_APPLICATION_FOLDER="$APPLICATION_FOLDER"
4953
echo "Exit status: $status | Expected: $expectedExitStatus"
5054
[ "$status" -eq $expectedExitStatus ]
5155
[ "${#lines[@]}" -eq 1 ]
56+
outputRegex='^ERROR: \.development file found at \./check_library_manager_compliance/ContainsDotDevelopment/\.development$'
57+
[[ "${lines[0]}" =~ $outputRegex ]]
5258
}
5359

5460
@test "check_library_manager_compliance \"./check_library_manager_compliance/ContainsSymlink\"" {
@@ -57,6 +63,8 @@ TESTS_BATS_APPLICATION_FOLDER="$APPLICATION_FOLDER"
5763
echo "Exit status: $status | Expected: $expectedExitStatus"
5864
[ "$status" -eq $expectedExitStatus ]
5965
[ "${#lines[@]}" -eq 1 ]
66+
outputRegex='^ERROR: Symlink found at \./check_library_manager_compliance/ContainsSymlink/IsSymlink$'
67+
[[ "${lines[0]}" =~ $outputRegex ]]
6068
}
6169

6270
@test "check_library_manager_compliance \"./check_library_manager_compliance/InvalidCharactersAtStartOfName\"" {
@@ -66,6 +74,10 @@ TESTS_BATS_APPLICATION_FOLDER="$APPLICATION_FOLDER"
6674
[ "$status" -eq $expectedExitStatus ]
6775
# check_valid_folder_name outputs an error message, then check_library_properties another
6876
[ "${#lines[@]}" -eq 2 ]
77+
outputRegex='^ERROR: Invalid folder name: -Foobar\. Folder name beginning with a - or \. is not allowed\.$'
78+
[[ "${lines[0]}" =~ $outputRegex ]]
79+
outputRegex="^ERROR: \./check_library_manager_compliance/InvalidCharactersAtStartOfName's name value -Foobar does not meet the requirements of the Arduino Library Manager indexer\. See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format$"
80+
[[ "${lines[1]}" =~ $outputRegex ]]
6981
}
7082

7183
@test "check_library_manager_compliance \"./check_library_manager_compliance/InvalidCharactersInName\"" {
@@ -74,6 +86,10 @@ TESTS_BATS_APPLICATION_FOLDER="$APPLICATION_FOLDER"
7486
echo "Exit status: $status | Expected: $expectedExitStatus"
7587
[ "$status" -eq $expectedExitStatus ]
7688
[ "${#lines[@]}" -eq 2 ]
89+
outputRegex='^ERROR: Invalid folder name: Foo\(bar\)\. Only letters, numbers, dots, dashes, and underscores are allowed\.$'
90+
[[ "${lines[0]}" =~ $outputRegex ]]
91+
outputRegex="^ERROR: \./check_library_manager_compliance/InvalidCharactersInName's name value Foo\(bar\) does not meet the requirements of the Arduino Library Manager indexer\. See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format$"
92+
[[ "${lines[1]}" =~ $outputRegex ]]
7793
}
7894

7995
@test "check_library_manager_compliance \"./check_library_manager_compliance/NameTooLong\"" {
@@ -82,4 +98,8 @@ TESTS_BATS_APPLICATION_FOLDER="$APPLICATION_FOLDER"
8298
echo "Exit status: $status | Expected: $expectedExitStatus"
8399
[ "$status" -eq $expectedExitStatus ]
84100
[ "${#lines[@]}" -eq 2 ]
101+
outputRegex='^ERROR: Folder name asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf exceeds the maximum of 63 characters\.$'
102+
[[ "${lines[0]}" =~ $outputRegex ]]
103+
outputRegex="^ERROR: \./check_library_manager_compliance/NameTooLong's name value asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf does not meet the requirements of the Arduino Library Manager indexer\. See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format$"
104+
[[ "${lines[1]}" =~ $outputRegex ]]
85105
}

0 commit comments

Comments
 (0)