mirror of
https://github.com/softinio/Fishee.git
synced 2025-02-22 13:36:04 -08:00
Add test for CLI main and add test plan
This commit is contained in:
parent
4287ddfed9
commit
aabda391c2
2 changed files with 84 additions and 1 deletions
|
@ -0,0 +1,77 @@
|
||||||
|
//
|
||||||
|
// Copyright © 2024 Salar Rahmanian.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Testing
|
||||||
|
@testable import Fishee
|
||||||
|
|
||||||
|
@Suite
|
||||||
|
final class FisheeTests {
|
||||||
|
@Test func DryRunTest() {
|
||||||
|
do {
|
||||||
|
let help = try #require(Fishee.parse(["--dry-run"]) as Fishee)
|
||||||
|
#expect(help.dryRun)
|
||||||
|
} catch {
|
||||||
|
Issue.record("Test failed! \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func HistoryFileTest() {
|
||||||
|
do {
|
||||||
|
let help = try #require(Fishee.parse(["--history-file", "/tmp/fishtest.txt"]) as Fishee)
|
||||||
|
#expect(help.fishHistoryLocationStr == "/tmp/fishtest.txt")
|
||||||
|
} catch {
|
||||||
|
Issue.record("Test failed! \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func OutputFileTest() {
|
||||||
|
do {
|
||||||
|
let help = try #require(Fishee.parse(["--output-file", "/tmp/fishtest.txt"]) as Fishee)
|
||||||
|
#expect(help.writeFileStr == "/tmp/fishtest.txt")
|
||||||
|
} catch {
|
||||||
|
Issue.record("Test failed! \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func RemoveDuplicatesTest() {
|
||||||
|
do {
|
||||||
|
let help = try #require(Fishee.parse(["--remove-duplicates"]) as Fishee)
|
||||||
|
#expect(help.removeDuplicates)
|
||||||
|
} catch {
|
||||||
|
Issue.record("Test failed! \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func BackupTest() {
|
||||||
|
do {
|
||||||
|
let help = try #require(Fishee.parse(["--backup"]) as Fishee)
|
||||||
|
#expect(help.backup)
|
||||||
|
} catch {
|
||||||
|
Issue.record("Test failed! \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test func NoBackupTest() {
|
||||||
|
do {
|
||||||
|
let help = try #require(Fishee.parse(["--no-backup"]) as Fishee)
|
||||||
|
#expect(!help.backup)
|
||||||
|
} catch {
|
||||||
|
Issue.record("Test failed! \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,7 +12,13 @@
|
||||||
"testTimeoutsEnabled" : true
|
"testTimeoutsEnabled" : true
|
||||||
},
|
},
|
||||||
"testTargets" : [
|
"testTargets" : [
|
||||||
|
{
|
||||||
|
"target" : {
|
||||||
|
"containerPath" : "container:",
|
||||||
|
"identifier" : "FisheeTests",
|
||||||
|
"name" : "FisheeTests"
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"version" : 1
|
"version" : 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue