diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2026-01-27 08:57:52 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2026-01-27 10:21:28 +0000 |
| commit | 71ad32b1e95a1c1dfca8e6ca4a530b77afcc4974 (patch) | |
| tree | 20e883dba3741a1a9016c74e2547abf2ecc849bf /pkg/aflow/tool/codeeditor/codeeditor_test.go | |
| parent | 65e102377f285f4cdf3f95214e06843a2052e9ae (diff) | |
pkg/aflow/flow/patching: harden against empty generated patches
Make codeeditor error on nop changes that don't actually change the code.
Make patch testing error on empty patch.
Perhaps we need a notion of "mandatory" tools that must be called
successfully at least once... not sure yet.
Diffstat (limited to 'pkg/aflow/tool/codeeditor/codeeditor_test.go')
| -rw-r--r-- | pkg/aflow/tool/codeeditor/codeeditor_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/aflow/tool/codeeditor/codeeditor_test.go b/pkg/aflow/tool/codeeditor/codeeditor_test.go index 06a97d7af..0b066e3b5 100644 --- a/pkg/aflow/tool/codeeditor/codeeditor_test.go +++ b/pkg/aflow/tool/codeeditor/codeeditor_test.go @@ -105,6 +105,25 @@ foo`) ) } +func TestCodeeditorNopEdit(t *testing.T) { + dir := writeTestFile(t, "src.c", ` +line0 +line1 +`) + aflow.TestTool(t, Tool, + state{ + KernelScratchSrc: dir, + }, + args{ + SourceFile: "src.c", + CurrentCode: " line0", + NewCode: "line0", + }, + struct{}{}, + `The edit does not change the code.`, + ) +} + func TestCodeeditorReplacement(t *testing.T) { type Test struct { curFile string |
