Skip to content

Commit

Permalink
add tests and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Apr 29, 2023
1 parent 9cfb3e8 commit c676034
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/CodeEditLanguages/Documentation.docc/CodeLanguage.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ let language = CodeLanguage.detectLanguageFrom(url: fileURL)
- Python
- Ruby
- Rust
- Scala
- SQL
- Swift
- YAML
Expand Down Expand Up @@ -92,6 +93,7 @@ let language = CodeLanguage.detectLanguageFrom(url: fileURL)
- ``python``
- ``ruby``
- ``rust``
- ``scala``
- ``sql``
- ``swift``
- ``yaml``
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ let query = TreeSitterModel.shared.swiftQuery
- ``pythonQuery``
- ``rubyQuery``
- ``rustQuery``
- ``scalaQuery``
- ``sqlQuery``
- ``swiftQuery``
- ``yamlQuery``
Expand Down
27 changes: 27 additions & 0 deletions Tests/CodeEditLanguagesTests/CodeEditLanguagesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,34 @@ final class CodeEditLanguagesTests: XCTestCase {
XCTAssertNotNil(query)
XCTAssertNotEqual(query?.patternCount, 0)
}

// MARK: - Scala

func test_CodeLanguageScala() throws {
let url = URL(fileURLWithPath: "~/path/to/file.scala")
let language = CodeLanguage.detectLanguageFrom(url: url)

XCTAssertEqual(language.id, .scala)
}

func test_CodeLanguageScalaScript() throws {
let url = URL(fileURLWithPath: "~/path/to/file.sc")
let language = CodeLanguage.detectLanguageFrom(url: url)

XCTAssertEqual(language.id, .scala)
}

func test_FetchQueryScala() throws {
var language = CodeLanguage.scala
language.resourceURL = bundleURL

let data = try Data(contentsOf: language.queryURL!)
let query = try? Query(language: language.language!, data: data)
XCTAssertNotNil(query)
XCTAssertNotEqual(query?.patternCount, 0)
}


// MARK: - SQL

func test_CodeLanguageSQL() throws {
Expand Down

0 comments on commit c676034

Please sign in to comment.