-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add custom string convertible conformance to OracleSQLError.ServerInfo
- Loading branch information
1 parent
6ffe70a
commit 4ed48f5
Showing
3 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the OracleNIO open source project | ||
// | ||
// Copyright (c) 2024 Timo Zacherl and the OracleNIO project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE for license information | ||
// See CONTRIBUTORS.md for the list of OracleNIO project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#if compiler(>=6.0) | ||
import Testing | ||
|
||
@testable import OracleNIO | ||
|
||
@Suite | ||
struct OracleSQLErrorTests { | ||
@Test | ||
func serverInfoDescription() { | ||
let errorWithMessage = OracleSQLError.ServerInfo( | ||
.init( | ||
number: 1017, | ||
isWarning: false, | ||
message: "ORA-01017: invalid credential or not authorized; logon denied\n", | ||
batchErrors: [] | ||
)) | ||
#expect( | ||
String(describing: errorWithMessage) == "ORA-01017: invalid credential or not authorized; logon denied") | ||
let errorWithoutMessage = OracleSQLError.ServerInfo( | ||
.init( | ||
number: 1017, | ||
isWarning: false, | ||
batchErrors: [] | ||
)) | ||
#expect(String(describing: errorWithoutMessage) == "ORA-1017") | ||
} | ||
} | ||
#endif |