-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add |-? operator and allow |-+ and |---+ to work with optionals (#28)
* Add |-? operator. Allow |-+ and |---+ to work with optionals. Tests for conditionals and optionals. * Removed |-+ and |---+ accepting optional in favour of |-? and |---? which accept any optional instead of a conditional. Expanded the |---? operators to work with Node + Node and [Node] + Node to match the |---+ operators. * Updated CI to Xcode 9.3 * Upgrade to Circle CI 2.0. Minor formatting changes. * Fighting with YAML.
- Loading branch information
1 parent
6a23b6a
commit a230d0f
Showing
13 changed files
with
286 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: 2 | ||
|
||
jobs: | ||
build-and-test: | ||
macos: | ||
xcode: "9.3.0" | ||
|
||
working_directory: /Users/distiller/project | ||
|
||
steps: | ||
- checkout | ||
- run: git submodule sync --recursive | ||
- run: git submodule update --init --recursive | ||
- run: script/test iphonesimulator "platform=iOS Simulator,name=iPhone 6,OS=11.3" Bento | ||
- run: script/test iphonesimulator "platform=iOS Simulator,name=iPhone 6,OS=11.3" Example build | ||
|
||
workflows: | ||
version: 2 | ||
build-and-test: | ||
jobs: | ||
- build-and-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
Bento.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import Nimble | ||
import XCTest | ||
import UIKit | ||
@testable import Bento | ||
|
||
class ConcatenationTests: XCTestCase { | ||
|
||
func testSectionConcatentation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
|
||
let box = Box<TestSectionId, TestRowId>.empty | ||
|-+ section | ||
|
||
expect(box.sections.count) == 1 | ||
} | ||
|
||
func testSectionOptionalNilConcatentation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let optional: String? = nil | ||
|
||
let box = Box<TestSectionId, TestRowId>.empty | ||
|-? .some(optional) { _ in | ||
section | ||
} | ||
|
||
expect(box.sections.count) == 0 | ||
} | ||
|
||
func testSectionOptionalSomeConcatentation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let optional: String? = "something" | ||
|
||
let box = Box<TestSectionId, TestRowId>.empty | ||
|-? .some(optional) { _ in | ||
section | ||
} | ||
|
||
expect(box.sections.count) == 1 | ||
} | ||
|
||
func testNodeConcatenation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let node = Node(id: TestRowId.first, | ||
component: TestCustomEqualityRenderable(value: 0)) | ||
|
||
let result = section | ||
|---+ node | ||
|
||
expect(result.rows.count) == 1 | ||
} | ||
|
||
func testNodeOptionalNilConcatenation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let node = Node(id: TestRowId.first, | ||
component: TestCustomEqualityRenderable(value: 0)) | ||
let optional: String? = nil | ||
|
||
let result: Section<TestSectionId, TestRowId> = section | ||
|---? .some(optional) { _ in | ||
node | ||
} | ||
|
||
expect(result.rows.count) == 0 | ||
} | ||
|
||
func testNodeOptionalSomeConcatenation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let node = Node(id: TestRowId.first, | ||
component: TestCustomEqualityRenderable(value: 0)) | ||
let optional: String? = "something" | ||
|
||
let result: Section<TestSectionId, TestRowId> = section | ||
|---? .some(optional) { _ in | ||
node | ||
} | ||
|
||
expect(result.rows.count) == 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import Nimble | ||
import XCTest | ||
import UIKit | ||
@testable import Bento | ||
|
||
class IfTests: XCTestCase { | ||
|
||
func testSectionConditionalTrueConcatentation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
|
||
let box = Box<TestSectionId, TestRowId>.empty | ||
|-? .iff(true, section) | ||
|
||
expect(box.sections.count) == 1 | ||
} | ||
|
||
func testSectionConditionalTrueClosureConcatentation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
|
||
let box = Box<TestSectionId, TestRowId>.empty | ||
|-? .iff(true) { | ||
section | ||
} | ||
|
||
expect(box.sections.count) == 1 | ||
} | ||
|
||
func testSectionConditionalFalseConcatentation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
|
||
let box = Box<TestSectionId, TestRowId>.empty | ||
|-? .iff(false, section) | ||
|
||
expect(box.sections.count) == 0 | ||
} | ||
|
||
func testSectionConditionalFalseClosureConcatentation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
|
||
let box = Box<TestSectionId, TestRowId>.empty | ||
|-? .iff(false) { | ||
section | ||
} | ||
|
||
expect(box.sections.count) == 0 | ||
} | ||
|
||
func testNodeConditionalTrueConcatenation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let node = Node(id: TestRowId.first, | ||
component: TestCustomEqualityRenderable(value: 0)) | ||
|
||
let result = section | ||
|---? .iff(true, node) | ||
|
||
expect(result.rows.count) == 1 | ||
} | ||
|
||
func testNodeConditionalTrueClosureConcatenation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let node = Node(id: TestRowId.first, | ||
component: TestCustomEqualityRenderable(value: 0)) | ||
|
||
let result = section | ||
|---? .iff(true) { | ||
node | ||
} | ||
|
||
expect(result.rows.count) == 1 | ||
} | ||
|
||
func testNodeConditionalFalseConcatenation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let node = Node(id: TestRowId.first, | ||
component: TestCustomEqualityRenderable(value: 0)) | ||
|
||
let result = section | ||
|---? .iff(false, node) | ||
|
||
expect(result.rows.count) == 0 | ||
} | ||
|
||
func testNodeConditionalFalseClosureConcatenation() { | ||
let section = Section<TestSectionId, TestRowId>(id: .first) | ||
let node = Node(id: TestRowId.first, | ||
component: TestCustomEqualityRenderable(value: 0)) | ||
|
||
let result = section | ||
|---? .iff(false) { | ||
node | ||
} | ||
|
||
expect(result.rows.count) == 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
github "Babylonpartners/ReactiveFeedback" "0.2.0" | ||
github "Quick/Nimble" "v7.1.0" | ||
github "Quick/Nimble" "v7.1.1" | ||
github "RACCommunity/FlexibleDiff" "0.0.5" | ||
github "ReactiveCocoa/ReactiveCocoa" "7.2.0" | ||
github "ReactiveCocoa/ReactiveSwift" "3.1.0" | ||
github "antitypical/Result" "3.2.4" | ||
github "jspahrsummers/xcconfigs" "0.11" | ||
github "onevcat/Kingfisher" "4.7.0" | ||
github "jspahrsummers/xcconfigs" "0.12" | ||
github "onevcat/Kingfisher" "4.8.0" |
Submodule Kingfisher
updated
175 files
Submodule Nimble
updated
6 files
+1 −1 | Gemfile | |
+39 −36 | Gemfile.lock | |
+1 −1 | Nimble.podspec | |
+5 −0 | Sources/NimbleObjectiveC/CurrentTestCaseTracker.h | |
+5 −0 | Sources/NimbleObjectiveC/DSL.m | |
+5 −0 | Sources/NimbleObjectiveC/NMBStringify.m |
Submodule xcconfigs
updated
from 40f9bc to bb7955
This file was deleted.
Oops, something went wrong.