forked from CodeEditApp/CodeEdit
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCodeFileDocument+UTTypeTests.swift
More file actions
77 lines (61 loc) · 1.75 KB
/
CodeFileDocument+UTTypeTests.swift
File metadata and controls
77 lines (61 loc) · 1.75 KB
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
71
72
73
74
75
76
77
//
// CodeFileDocument+UTTypeTests.swift
// CodeEditTests
//
// Created by Axel Martinez on 23/6/24.
//
import XCTest
@testable import CodeEdit
final class UTTypeTests: XCTestCase {
private var document: CodeFileDocument!
override func setUp() {
document = .init()
}
func testTextFileByContent() {
document.content = NSTextStorage(string: "Some text content")
XCTAssertEqual(document.utType, .text)
}
func testJSONFile() {
document.fileType = "public.json"
XCTAssertEqual(document.utType, .json)
}
func testTextFileByExtension() {
document.fileType = "public.python-script"
XCTAssertEqual(document.utType, .pythonScript)
}
func testPdfFile() {
document.fileType = "com.adobe.pdf"
XCTAssertEqual(document.utType, .pdf)
}
func testImageFile() {
document.fileType = "public.image"
XCTAssertEqual(document.utType, .image)
}
func testPngFile() {
document.fileType = "public.png"
XCTAssertEqual(document.utType, .png)
}
func testAudioFile() {
document.fileType = "public.audio"
XCTAssertEqual(document.utType, .audio)
}
func testMp3File() {
document.fileType = "public.mp3"
XCTAssertEqual(document.utType, .mp3)
}
func testVideoFile() {
document.fileType = "public.video"
XCTAssertEqual(document.utType, .video)
}
func testMpeg4File() {
document.fileType = "public.mpeg-4"
XCTAssertEqual(document.utType, .mpeg4Movie)
}
func testUnknownFileType() {
document.fileType = "unknown"
XCTAssertNil(document.utType)
}
func testEmptyFileTypeAndContent() {
XCTAssertNil(document.utType)
}
}