Skip to content

Commit 3841a75

Browse files
committed
Add some notes explaining what invariants are violated.
1 parent 3b43b39 commit 3841a75

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Tests/SystemTests/FilePathTests/FilePathDecodable.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import XCTest
1919
final class FilePathDecodableTest: XCTestCase {
2020
func testInvalidFilePath() {
2121
// _storage is a valid SystemString, but the invariants of FilePath are
22-
// violated.
22+
// violated (specifically, _storage is not normal).
2323
let input: [UInt8] = [
2424
123, 34, 95,115,116,111,114, 97,103,101, 34, 58,123, 34,110,117,108,108,
2525
84,101,114,109,105,110, 97,116,101,100, 83,116,111,114, 97,103,101, 34,
@@ -77,7 +77,8 @@ final class FilePathDecodableTest: XCTestCase {
7777
}
7878

7979
func testInvalidSystemString() {
80-
// _storage is a SystemString whose invariants are violated
80+
// _storage is a SystemString whose invariants are violated; it contains
81+
// a non-terminating null byte.
8182
let input: [UInt8] = [
8283
123, 34, 95,115,116,111,114, 97,103,101, 34, 58,123, 34,110,117,108,108,
8384
84,101,114,109,105,110, 97,116,101,100, 83,116,111,114, 97,103,101, 34,
@@ -95,7 +96,7 @@ final class FilePathDecodableTest: XCTestCase {
9596

9697
func testInvalidExample() {
9798
// Another misformed example from Johannes that violates FilePath's
98-
// invariants
99+
// invariants by virtue of not being normalized.
99100
let input: [UInt8] = [
100101
123, 34, 95,115,116,111,114, 97,103,101, 34, 58,123, 34,110,117,108,108,
101102
84,101,114,109,105,110, 97,116,101,100, 83,116,111,114, 97,103,101, 34,
@@ -113,6 +114,7 @@ final class FilePathDecodableTest: XCTestCase {
113114
}
114115

115116
func testEmptyString() {
117+
// FilePath with an empty (and hence not null-terminated) SystemString.
116118
let input: [UInt8] = [
117119
123, 34, 95,115,116,111,114, 97,103,101, 34, 58,123, 34,110,117,108,108,
118120
84,101,114,109,105,110, 97,116,101,100, 83,116,111,114, 97,103,101, 34,

0 commit comments

Comments
 (0)