1234567891011121314151617181920212223242526272829303132333435363738394041 |
- //
- // File.swift
- //
- //
- // Created by Miguel de Icaza on 4/29/20.
- //
- import Foundation
- import XCTest
- @testable import SwiftTerm
- final class SelectionTests: XCTestCase, TerminalDelegate {
- func send(source: Terminal, data: ArraySlice<UInt8>) {
- print ("here")
- }
-
- func testDoesNotCrashWhenSelectingWordOrExpressionOutsideColumnRange ()
- {
- let terminal = Terminal(delegate: self, options: TerminalOptions (cols: 10, rows: 10))
- let selection = SelectionService(terminal: terminal)
- terminal.feed (text: "1234567890")
-
- // depending on the size of terminal view, there might be a space near the margin where the user
- // clicks which might result in a col or row outside the bounds of terminal,
- selection.selectWordOrExpression(at: Position(col: -1, row: 0), in: terminal.buffer)
- selection.selectWordOrExpression(at: Position(col: 11, row: 0), in: terminal.buffer)
- }
-
- func testDoesNotCrashWhenSelectingWordOrExpressionOutsideRowRange ()
- {
- let terminal = Terminal(delegate: self, options: TerminalOptions (cols: 10, rows: 10))
- let selection = SelectionService(terminal: terminal)
- terminal.feed (text: "1234567890")
- // depending on the size of terminal view, there might be a space near the margin where the user
- // clicks which might result in a col or row outside the bounds of terminal,
- selection.selectWordOrExpression(at: Position (col: 0, row: -1), in: terminal.buffer)
- }
- }
|