Skip to content

Commit e4ca02b

Browse files
committed
Reproduce suffixed .Point + .Num0 bug.
1 parent 8d56f2a commit e4ca02b

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

ReactKitCalculatorTests/OutputSpec.swift

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class OutputSpec: QuickSpec
5151
(p, "output") <~ calculator.outputSignal
5252
}
5353

54-
describe("accumulate digits") {
54+
describe("accumulate number") {
5555

5656
context("digits") {
5757

@@ -102,6 +102,33 @@ class OutputSpec: QuickSpec
102102
}
103103

104104
}
105+
106+
context("decimal point + zero") {
107+
108+
it("`0 . 0` should print `0.0`") {
109+
110+
p.input = "0"
111+
expect(p.output!).to(equal("0"))
112+
113+
p.input = "."
114+
expect(p.output!).to(equal("0."))
115+
116+
p.input = "0"
117+
expect(p.output!).to(equal("0.0"))
118+
119+
}
120+
121+
it("`. 0` should print `0.0`") {
122+
123+
p.input = "."
124+
expect(p.output!).to(equal("0.")) // "0" should be prepended
125+
126+
p.input = "0"
127+
expect(p.output!).to(equal("0.0"))
128+
129+
}
130+
131+
}
105132
}
106133

107134
describe("simple operation") {

0 commit comments

Comments
 (0)