Skip to content

Commit

Permalink
Use syntaxes and themes in main bundle for test
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Oct 20, 2024
1 parent 4c8242d commit 4d1a43b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
9 changes: 0 additions & 9 deletions CotEditor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@
);
target = 8D15AC270486D014006FF6A4 /* CotEditor -Sparkle */;
};
2AEBC8B42CBB745800230895 /* Exceptions for "CotEditor" folder in "Tests" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Resources/Syntaxes,
Resources/Themes,
);
target = 2AC71DDE1BF0BDBC002E1434 /* Tests */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */

/* Begin PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
Expand Down Expand Up @@ -164,7 +156,6 @@
2AEBC8B12CBB745800230895 /* Exceptions for "CotEditor" folder in "Copy Command-Line Tools" phase from "CotEditor" target */,
2AEBC8B22CBB745800230895 /* Exceptions for "CotEditor" folder in "CotEditor -Sparkle" target */,
2AEBC8B32CBB745800230895 /* Exceptions for "CotEditor" folder in "Copy Command-Line Tools" phase from "CotEditor -Sparkle" target */,
2AEBC8B42CBB745800230895 /* Exceptions for "CotEditor" folder in "Tests" target */,
);
explicitFileTypes = {
Resources/cot = text.script.python;
Expand Down
3 changes: 1 addition & 2 deletions Tests/Sources/Models/SyntaxTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ actor SyntaxTests {

init() throws {

let bundle = Bundle(for: type(of: self))
let urls = try #require(bundle.urls(forResourcesWithExtension: "yml", subdirectory: "Syntaxes"))
let urls = try #require(Bundle.main.urls(forResourcesWithExtension: "yml", subdirectory: "Syntaxes"))

// load syntaxes
let decoder = YAMLDecoder()
Expand Down
4 changes: 2 additions & 2 deletions Tests/Sources/Models/ThemeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ actor ThemeTests {
/// Tests if all of bundled themes are valid.
@Test func bundledThemes() throws {

let themeDirectoryURL = try #require(Bundle(for: type(of: self)).url(forResource: self.themeDirectoryName, withExtension: nil))
let themeDirectoryURL = try #require(Bundle.main.url(forResource: self.themeDirectoryName, withExtension: nil))
let urls = try FileManager.default.contentsOfDirectory(at: themeDirectoryURL, includingPropertiesForKeys: nil, options: [.skipsSubdirectoryDescendants, .skipsHiddenFiles])
.filter { UTType.cotTheme.preferredFilenameExtension == $0.pathExtension }

Expand All @@ -100,7 +100,7 @@ private extension ThemeTests {
func loadThemeWithName(_ name: String) throws -> Theme {

guard
let url = Bundle(for: type(of: self)).url(forResource: name, withExtension: UTType.cotTheme.preferredFilenameExtension, subdirectory: self.themeDirectoryName)
let url = Bundle.main.url(forResource: name, withExtension: UTType.cotTheme.preferredFilenameExtension, subdirectory: self.themeDirectoryName)
else { throw CocoaError(.fileNoSuchFile) }

return try Theme(contentsOf: url)
Expand Down

0 comments on commit 4d1a43b

Please sign in to comment.