Skip to content

Commit

Permalink
feat: improve code format
Browse files Browse the repository at this point in the history
  • Loading branch information
hsluoyz committed Dec 17, 2024
1 parent 21de7f6 commit d2b539b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ let package = Package(
.product(name: "Regex", package: "Regex"),
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOTransportServices", package: "swift-nio-transport-services")

]

),

.testTarget(
name: "CasbinTests",
dependencies: ["Casbin"],
Expand Down
10 changes: 5 additions & 5 deletions Tests/CasbinTests/ConfigTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ final class ConfigTests: XCTestCase {
try pool.syncShutdownGracefully()
try elg.syncShutdownGracefully()
} catch {

}
}

func testGet() throws {
let filePath = #file.components(separatedBy: "ConfigTests.swift")[0] + "examples/testini.ini"
pool.start()
let fileIo = NonBlockingFileIO(threadPool: pool)
var config = try Config.from(file: filePath, fileIo: fileIo, on: elg.next())
.wait()

XCTAssertEqual(true, config.getBool(key: "debug"))
XCTAssertEqual(64, config.getInt(key: "math::math.i64"))
XCTAssertEqual(64.1, config.getFloat(key: "math::math.f64"))
Expand All @@ -37,7 +37,7 @@ final class ConfigTests: XCTestCase {
try pool.syncShutdownGracefully()
try elg.syncShutdownGracefully()
}

func testFromText() throws {
let text = #"""
# test config
Expand All @@ -61,7 +61,7 @@ final class ConfigTests: XCTestCase {
math.i64 = 64
math.f64 = 64.1
"""#

var config = try Config.from(text: text, on: elg.next()).wait()
XCTAssertEqual(true, config.getBool(key: "debug"))
XCTAssertEqual(64, config.getInt(key: "math::math.i64"))
Expand All @@ -71,7 +71,7 @@ final class ConfigTests: XCTestCase {
XCTAssertEqual("new test key", config.get(key: "other::key1"))
config.set(key: "other::key1", value: "test key")
XCTAssertEqual("test key", config.get(key: "other::key1"))

try pool.syncShutdownGracefully()
try elg.syncShutdownGracefully()
}
Expand Down

0 comments on commit d2b539b

Please sign in to comment.