Skip to content

Commit

Permalink
Add some notes explaining what invariants are violated.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentyrone committed Jul 17, 2024
1 parent 3b43b39 commit 3841a75
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Tests/SystemTests/FilePathTests/FilePathDecodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 3841a75

Please sign in to comment.