Skip to content
Merged

Lint #262

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
echo "### Here's how to fix the formatting locally:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "```bash" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo "# Format all Swift files" >> $GITHUB_STEP_SUMMARY
echo 'swift format -i --recursive .' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
1 change: 1 addition & 0 deletions Sources/Tokenizers/String+PreTokenization.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation

import struct Hub.Config

enum StringSplitPattern {
Expand Down
1 change: 1 addition & 0 deletions Tests/TokenizersTests/ChatTemplateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import Testing

@testable import Tokenizers

@Suite("Chat Template Tests")
Expand Down
1 change: 1 addition & 0 deletions Tests/TokenizersTests/FactoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import Hub
import Testing

@testable import Tokenizers

private func makeHubApi() -> (api: HubApi, downloadDestination: URL) {
Expand Down
33 changes: 11 additions & 22 deletions Tests/TokenizersTests/PreTokenizerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,64 +179,53 @@ struct PreTokenizerTests {
@Test("Split behavior merged with previous")
func splitBehaviorMergedWithPrevious() {
#expect(
"the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) ==
["the-", "final-", "-", "countdown"]
"the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) == ["the-", "final-", "-", "countdown"]
)

#expect(
"the-final--countdown-".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) ==
["the-", "final-", "-", "countdown-"]
"the-final--countdown-".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) == ["the-", "final-", "-", "countdown-"]
)

#expect(
"the-final--countdown--".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) ==
["the-", "final-", "-", "countdown-", "-"]
"the-final--countdown--".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) == ["the-", "final-", "-", "countdown-", "-"]
)

#expect(
"-the-final--countdown--".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) ==
["-", "the-", "final-", "-", "countdown-", "-"]
"-the-final--countdown--".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) == ["-", "the-", "final-", "-", "countdown-", "-"]
)

#expect(
"--the-final--countdown--".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) ==
["-", "-", "the-", "final-", "-", "countdown-", "-"]
"--the-final--countdown--".split(by: "-", options: .caseInsensitive, behavior: .mergedWithPrevious) == ["-", "-", "the-", "final-", "-", "countdown-", "-"]
)
}

@Test("Split behavior merged with next")
func splitBehaviorMergedWithNext() {
#expect(
"the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .mergedWithNext) ==
["the", "-final", "-", "-countdown"]
"the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .mergedWithNext) == ["the", "-final", "-", "-countdown"]
)

#expect(
"-the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .mergedWithNext) ==
["-the", "-final", "-", "-countdown"]
"-the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .mergedWithNext) == ["-the", "-final", "-", "-countdown"]
)

#expect(
"--the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .mergedWithNext) ==
["-", "-the", "-final", "-", "-countdown"]
"--the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .mergedWithNext) == ["-", "-the", "-final", "-", "-countdown"]
)

#expect(
"--the-final--countdown-".split(by: "-", options: .caseInsensitive, behavior: .mergedWithNext) ==
["-", "-the", "-final", "-", "-countdown", "-"]
"--the-final--countdown-".split(by: "-", options: .caseInsensitive, behavior: .mergedWithNext) == ["-", "-the", "-final", "-", "-countdown", "-"]
)
}

@Test("Split behavior other")
func splitBehaviorOther() {
#expect(
"the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .isolated) ==
["the", "-", "final", "-", "-", "countdown"]
"the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .isolated) == ["the", "-", "final", "-", "-", "countdown"]
)

#expect(
"the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .removed) ==
["the", "final", "countdown"]
"the-final--countdown".split(by: "-", options: .caseInsensitive, behavior: .removed) == ["the", "final", "countdown"]
)
}

Expand Down
Loading