-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTests+Wrapping.swift
70 lines (69 loc) · 1.69 KB
/
Tests+Wrapping.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// Wrapping.swift
// MarkdownEditor
//
// Created by Dave Coleman on 9/9/2024.
//
//import Testing
//import Foundation
//
//@testable import MarkdownEditor
//
//@MainActor @Suite("Wrapping tests")
//struct WrappingTests {
//
// let textView = MarkdownTextView(
// frame: .zero,
// textContainer: nil,
//// action: Markdown.SyntaxAction(syntax: .bold),
// configuration: .init()
// )
//
// let exampleString = """
// # Header
//
// This is **bold** text.
// """
// let exampleString02 = "This has some **bold** text."
//
// @Test("Wrap text with bold syntax", arguments:
//// Markdown.Syntax.allCases
// [Markdown.Syntax.bold]
// )
//
// func testWrapping(for syntax: Markdown.Syntax) throws {
//
// textView.string = "Hello, world!"
// textView.setSelectedRange(NSRange(location: 0, length: 5))
//
// for shortcut in syntax.shortcuts {
// textView.handleWrapping(.wrap, for: syntax)
// }
//
// #expect(textView.string == "**Hello**, world!")
// #expect(textView.selectedRange() == NSRange(location: 2, length: 5))
//
//// #expect(
//// wrappedString.hasPrefix(
//// String(
//// repeating: "\(syntax.leadingCharacter)" ?? "",
//// count: syntax.leadingCharacterCount ?? 0
//// )
//// )
//// )
//// #expect(
//// wrappedString.hasSuffix(
//// String(
//// repeating: "\(syntax.trailingCharacter)" ?? "",
//// count: syntax.trailingCharacterCount ?? 0
//// )
//// )
//// )
//// #expect(wrappedRange.location == (syntax.leadingCharacterCount ?? 0))
//// #expect(wrappedRange.length == testString.count)
//
//
// }
//
//
//}