add more tests
This commit is contained in:
parent
c1a8fb7e03
commit
638b867503
5 changed files with 1268 additions and 3 deletions
|
|
@ -135,4 +135,12 @@ describe("deterministicApplyLazyEdit(", () => {
|
|||
test("calculator docstrings", async () => {
|
||||
await expectDiff("calculator-docstrings.js");
|
||||
});
|
||||
|
||||
test("top level same blocks", async () => {
|
||||
await expectDiff("top-level-same.js");
|
||||
});
|
||||
|
||||
test("gui add toggle", async () => {
|
||||
await expectDiff("gui.js");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
1186
core/edit/lazy/test-examples/gui.js.diff
Normal file
1186
core/edit/lazy/test-examples/gui.js.diff
Normal file
File diff suppressed because it is too large
Load diff
64
core/edit/lazy/test-examples/top-level-same.js.diff
Normal file
64
core/edit/lazy/test-examples/top-level-same.js.diff
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
class Calculator {
|
||||
constructor() {
|
||||
this.result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class Subtract extends Calculator {
|
||||
sub(num1, num2) {
|
||||
this.result = num1 - num2;
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
|
||||
class Add extends Calculator {
|
||||
add(num1, num2) {
|
||||
this.result = num1 + num2;
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
// ... existing code ...
|
||||
|
||||
class Subtract extends Calculator {
|
||||
sub(num1, num2) {
|
||||
this.result = num1 - num2;
|
||||
|
||||
if (this.result < 0) {
|
||||
throw new Error("Result cannot be negative");
|
||||
}
|
||||
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
|
||||
// ... existing code ...
|
||||
|
||||
---
|
||||
|
||||
class Calculator {
|
||||
constructor() {
|
||||
this.result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class Subtract extends Calculator {
|
||||
sub(num1, num2) {
|
||||
this.result = num1 - num2;
|
||||
+
|
||||
+ if (this.result < 0) {
|
||||
+ throw new Error("Result cannot be negative");
|
||||
+ }
|
||||
+
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
|
||||
class Add extends Calculator {
|
||||
add(num1, num2) {
|
||||
this.result = num1 + num2;
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
|
|
@ -26,15 +26,19 @@ class Anthropic extends BaseLLM {
|
|||
2. Never separate the code into multiple code blocks.
|
||||
3. Only include the code that is being added.
|
||||
4. Replace existing code with a "lazy" block like this: "// ... existing code ..."
|
||||
5. If the user submits a code block that contains a filename in the language specifier, always include the filename in any code block you generate based on that file. The filename should be on the same line as the language specifier in your code block.
|
||||
5. You must always provide 1-2 lines of context above and below a "lazy" block
|
||||
6. If the user submits a code block that contains a filename in the language specifier, always include the filename in any code block you generate based on that file. The filename should be on the same line as the language specifier in your code block.
|
||||
|
||||
Example 1:
|
||||
Input:
|
||||
\`\`\`test.js
|
||||
import addition from "addition"
|
||||
|
||||
class Calculator {
|
||||
constructor() {
|
||||
this.result = 0;
|
||||
}
|
||||
|
||||
add(number) {
|
||||
this.result += number;
|
||||
return this;
|
||||
|
|
@ -45,6 +49,9 @@ User request: Add a subtract method
|
|||
|
||||
Output:
|
||||
\`\`\`javascript test.js
|
||||
// ... existing code ...
|
||||
import subtraction from "subtraction"
|
||||
|
||||
class Calculator {
|
||||
// ... existing code ...
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ function StepContainer(props: StepContainerProps) {
|
|||
{(props.isLast || isHovered || typeof feedback !== "undefined") &&
|
||||
!active && (
|
||||
<div
|
||||
className="flex items-center gap-1 absolute -bottom-2 right-1"
|
||||
className="flex items-center gap-1 absolute -bottom-3 right-2"
|
||||
style={{
|
||||
color: lightGray,
|
||||
fontSize: getFontSize() - 3,
|
||||
|
|
@ -198,7 +198,7 @@ function StepContainer(props: StepContainerProps) {
|
|||
/>
|
||||
</ButtonWithTooltip>
|
||||
)}
|
||||
<ButtonWithTooltip text="Delete Message" tabIndex={-1}>
|
||||
<ButtonWithTooltip text="Delete" tabIndex={-1}>
|
||||
<TrashIcon
|
||||
color={lightGray}
|
||||
width="1.2em"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue