found a failing edge case
This commit is contained in:
parent
ef17fa81a7
commit
06859ee9bf
2 changed files with 98 additions and 1 deletions
|
|
@ -133,10 +133,14 @@ describe("deterministicApplyLazyEdit(", () => {
|
|||
await expectDiff("fastapi.py");
|
||||
});
|
||||
|
||||
test.only("calculator exp", async () => {
|
||||
test("calculator exp", async () => {
|
||||
await expectDiff("calculator-exp.js");
|
||||
});
|
||||
|
||||
test.only("calculator exp2", async () => {
|
||||
await expectDiff("calculator-exp2.js");
|
||||
});
|
||||
|
||||
test("calculator comments", async () => {
|
||||
await expectDiff("calculator-comments.js");
|
||||
});
|
||||
|
|
|
|||
93
core/edit/lazy/test-examples/calculator-exp2.js.diff
Normal file
93
core/edit/lazy/test-examples/calculator-exp2.js.diff
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
class Calculator {
|
||||
constructor() {
|
||||
this.result = 0;
|
||||
}
|
||||
|
||||
add(number) {
|
||||
this.result += number;
|
||||
return this;
|
||||
}
|
||||
|
||||
subtract(number) {
|
||||
this.result -= number;
|
||||
return this;
|
||||
}
|
||||
|
||||
multiply(number) {
|
||||
this.result *= number;
|
||||
return this;
|
||||
}
|
||||
|
||||
divide(number) {
|
||||
if (number === 0) {
|
||||
throw new Error("Cannot divide by zero");
|
||||
}
|
||||
this.result /= number;
|
||||
return this;
|
||||
}
|
||||
|
||||
getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.result = 0;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
class Calculator {
|
||||
// ... existing code ...
|
||||
|
||||
exp(number) {
|
||||
this.result = Math.pow(this.result, number);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
class Calculator {
|
||||
constructor() {
|
||||
this.result = 0;
|
||||
}
|
||||
|
||||
add(number) {
|
||||
this.result += number;
|
||||
return this;
|
||||
}
|
||||
|
||||
subtract(number) {
|
||||
this.result -= number;
|
||||
return this;
|
||||
}
|
||||
|
||||
multiply(number) {
|
||||
this.result *= number;
|
||||
return this;
|
||||
}
|
||||
|
||||
divide(number) {
|
||||
if (number === 0) {
|
||||
throw new Error("Cannot divide by zero");
|
||||
}
|
||||
this.result /= number;
|
||||
return this;
|
||||
}
|
||||
|
||||
getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.result = 0;
|
||||
return this;
|
||||
}
|
||||
+
|
||||
+ exp(a) {
|
||||
+ this.result = Math.pow(this.result, a);
|
||||
+ return this;
|
||||
+ }
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue