Skip to content

Commit

Permalink
Docs, tests, and migrating to main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Feb 19, 2021
1 parent e56cea9 commit dd8afec
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- master
- main
pull_request:
branches:
- '**'
Expand All @@ -17,8 +17,6 @@ jobs:
destination: ["platform=macOS", "platform=iOS Simulator,name=iPhone 8"]
steps:
- uses: actions/checkout@v1
- name: install swiftlint
run: HOMEBREW_NO_INSTALL_CLEANUP=1 brew install swiftlint
- name: install dependencies
run: carthage bootstrap
- name: update submodules
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ChimeHQ/Rearrange" "master"
github "ChimeHQ/Rearrange"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ChimeHQ/Rearrange" "40bb81d2c28aca334aeedb50cc29e11691e586d7"
github "ChimeHQ/Rearrange" "1.1.6"
2 changes: 2 additions & 0 deletions TextStory/TextStoring.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation

public protocol TextStoring {
/// Returns the UTF-16 length of the receiver
var length: Int { get }

func substring(from range: NSRange) -> String?
Expand All @@ -30,6 +31,7 @@ public extension TextStoring {
applyMutation(mutation)
}

/// Returns an NSRange from 0 to the UTF-16 length
var fullRange: NSRange {
return NSRange(location: 0, length: length)
}
Expand Down
4 changes: 2 additions & 2 deletions TextStory/TextStory.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos
PRODUCT_NAME = TextStory
PRODUCT_BUNDLE_IDENTIFIER = com.chimehq.TextStory
PRODUCT_MODULE_NAME = TextStory
CURRENT_PROJECT_VERSION = 5
MARKETING_VERSION = 0.3.2
CURRENT_PROJECT_VERSION = 6
MARKETING_VERSION = 0.3.3

INFOPLIST_FILE = TextStory/Info.plist
MACH_O_TYPE = staticlib
Expand Down
17 changes: 17 additions & 0 deletions TextStoryTests/TextStoringTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,20 @@ class TextStoringTests: XCTestCase {
XCTAssertEqual(mutation.postApplyRange, NSRange(0..<2))
}
}

extension TextStoringTests {
func testFullRange() {
let storage = NSTextStorage(string: "abc")

XCTAssertEqual(storage.fullRange, NSRange(0..<3))
}

func testInsertString() {
let storage = NSTextStorage(string: "abc")

storage.insertString("def", at: 3)
storage.insertString("123", at: 0)

XCTAssertEqual(storage.string, "123abcdef")
}
}

0 comments on commit dd8afec

Please sign in to comment.