mas/MasKitTests/OutputListenerSpec.swift

49 lines
1.3 KiB
Swift
Raw Normal View History

//
// OutputListenerSpec.swift
// MasKitTests
//
// Created by Ben Chatelain on 1/8/19.
// Copyright © 2019 mas-cli. All rights reserved.
//
import Nimble
2019-01-30 06:15:24 +00:00
import Quick
class OutputListenerSpec: QuickSpec {
override func spec() {
xdescribe("output listener") {
it("can intercept a single line written stdout") {
let output = OutputListener()
output.openConsolePipe()
let expectedOutput = "hi there"
print("hi there", terminator: "")
// output is async so need to wait for contents to be updated
expect(output.contents).toEventuallyNot(beEmpty())
expect(output.contents) == expectedOutput
output.closeConsolePipe()
}
it("can intercept multiple lines written stdout") {
let output = OutputListener()
output.openConsolePipe()
let expectedOutput = """
2019-01-30 06:15:24 +00:00
hi there
2019-01-30 06:15:24 +00:00
"""
print("hi there")
// output is async so need to wait for contents to be updated
expect(output.contents).toEventuallyNot(beEmpty())
expect(output.contents) == expectedOutput
output.closeConsolePipe()
}
}
}
}