ReflowTests.swift 984 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // ReflowTests.swift
  3. //
  4. //
  5. // Created by Miguel de Icaza on 4/17/20.
  6. //
  7. import Foundation
  8. import XCTest
  9. @testable import SwiftTerm
  10. final class ReflowTests: XCTestCase {
  11. func testDoesNotCrashWhenReflowingToTinyWidth ()
  12. {
  13. let options = TerminalOptions(cols: 10, rows: 10, scrollback: 1)
  14. let h = HeadlessTerminal (queue: SwiftTermTests.queue, options: options) { exitCode in }
  15. let t = h.terminal!
  16. t.feed (text: "1234567890\r\n")
  17. t.feed (text: "ABCDEFGH\r\n")
  18. t.feed (text: "abcdefghijklmnopqrstxxx\r\n")
  19. t.feed (text: "\r\n")
  20. // if we resize to a small column width, content is pushed back up and out the top
  21. // of the buffer. Ensure that this does not crash
  22. t.resize(cols: 3, rows: 10)
  23. XCTAssert(true)
  24. }
  25. static var allTests = [
  26. ("testDoesNotCrashWhenReflowingToTinyWidth", testDoesNotCrashWhenReflowingToTinyWidth),
  27. ]
  28. }