forked from CodeEditApp/CodeEdit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeFileTests.swift
More file actions
37 lines (32 loc) · 1.09 KB
/
CodeFileTests.swift
File metadata and controls
37 lines (32 loc) · 1.09 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
//
// UnitTests.swift
// CodeEditModules/CodeFileTests
//
// Created by Marco Carnevali on 18/03/22.
//
import Foundation
import SwiftUI
import XCTest
@testable import CodeEdit
final class CodeFileUnitTests: XCTestCase {
func testViewContentLoading() throws {
let directory = try FileManager.default.url(
for: .developerApplicationDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: true
)
.appendingPathComponent("CodeEdit", isDirectory: true)
.appendingPathComponent("WorkspaceClientTests", isDirectory: true)
try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
let fileURL = directory.appendingPathComponent("fakeFile.swift")
let fileContent = "func test(){}"
try fileContent.data(using: .utf8)?.write(to: fileURL)
let codeFile = try CodeFileDocument(
for: fileURL,
withContentsOf: fileURL,
ofType: "public.source-code"
)
XCTAssertEqual(codeFile.content, fileContent)
}
}