From 3841a7531f8a1f177dc6825fee207fcf83ff69fc Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Wed, 17 Jul 2024 13:49:15 -0400 Subject: [PATCH] Add some notes explaining what invariants are violated. --- Tests/SystemTests/FilePathTests/FilePathDecodable.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tests/SystemTests/FilePathTests/FilePathDecodable.swift b/Tests/SystemTests/FilePathTests/FilePathDecodable.swift index a9d687da..290bef2f 100644 --- a/Tests/SystemTests/FilePathTests/FilePathDecodable.swift +++ b/Tests/SystemTests/FilePathTests/FilePathDecodable.swift @@ -19,7 +19,7 @@ import XCTest final class FilePathDecodableTest: XCTestCase { func testInvalidFilePath() { // _storage is a valid SystemString, but the invariants of FilePath are - // violated. + // violated (specifically, _storage is not normal). let input: [UInt8] = [ 123, 34, 95,115,116,111,114, 97,103,101, 34, 58,123, 34,110,117,108,108, 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 { } func testInvalidSystemString() { - // _storage is a SystemString whose invariants are violated + // _storage is a SystemString whose invariants are violated; it contains + // a non-terminating null byte. let input: [UInt8] = [ 123, 34, 95,115,116,111,114, 97,103,101, 34, 58,123, 34,110,117,108,108, 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 { func testInvalidExample() { // Another misformed example from Johannes that violates FilePath's - // invariants + // invariants by virtue of not being normalized. let input: [UInt8] = [ 123, 34, 95,115,116,111,114, 97,103,101, 34, 58,123, 34,110,117,108,108, 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 { } func testEmptyString() { + // FilePath with an empty (and hence not null-terminated) SystemString. let input: [UInt8] = [ 123, 34, 95,115,116,111,114, 97,103,101, 34, 58,123, 34,110,117,108,108, 84,101,114,109,105,110, 97,116,101,100, 83,116,111,114, 97,103,101, 34,