from: github.com/remko/age-plugin-se

This commit is contained in:
2023-03-09 22:52:40 +08:00
parent 57fac2893c
commit 71927745a8
22 changed files with 2720 additions and 2 deletions

27
Tests/MemoryStream.swift Normal file
View File

@@ -0,0 +1,27 @@
@testable import age_plugin_se
class MemoryStream: Stream {
var inputLines: [String] = []
var outputLines: [String] = []
var output: String {
return outputLines.joined(separator: "\n")
}
func add(input: String) {
inputLines.append(contentsOf: input.components(separatedBy: "\n"))
}
func readLine() -> String? {
if inputLines.isEmpty {
return nil
}
let result = inputLines[0]
inputLines.removeFirst()
return result
}
func writeLine(_ line: String) {
outputLines.append(contentsOf: line.components(separatedBy: "\n"))
}
}