From 2e4c4ee19437e18da1abdba70f65c1eddafb0d1c Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Wed, 2 Nov 2016 13:46:33 -0700 Subject: [PATCH] Fully test case/when/else --- .../diff-summaries/ruby/case-when-else.json | 262 ++++++++++++++++++ .../corpus/diff-summaries/ruby/when-else.json | 262 ++++++++++++++++++ test/corpus/generated/ruby.json | 10 + test/corpus/repos/ruby | 2 +- 4 files changed, 535 insertions(+), 1 deletion(-) create mode 100644 test/corpus/diff-summaries/ruby/case-when-else.json create mode 100644 test/corpus/diff-summaries/ruby/when-else.json diff --git a/test/corpus/diff-summaries/ruby/case-when-else.json b/test/corpus/diff-summaries/ruby/case-when-else.json new file mode 100644 index 000000000..41a2eb60a --- /dev/null +++ b/test/corpus/diff-summaries/ruby/case-when-else.json @@ -0,0 +1,262 @@ +[{ + "testCaseDescription": "ruby-case-when-else-insert-test", + "expectedResult": { + "changes": { + "case-when-else.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-when-else.rb" + ], + "sha1": "7b88300c1604ec1f6e775ac48ea3f43087545738", + "gitDir": "test/corpus/repos/ruby", + "sha2": "cba20046e29c4a43a6a2f7a20fbe71372ea2f485" +} +,{ + "testCaseDescription": "ruby-case-when-else-replacement-insert-test", + "expectedResult": { + "changes": { + "case-when-else.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 10, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-when-else.rb" + ], + "sha1": "cba20046e29c4a43a6a2f7a20fbe71372ea2f485", + "gitDir": "test/corpus/repos/ruby", + "sha2": "31387a19632065bd797ebae9c680b375b46e72a4" +} +,{ + "testCaseDescription": "ruby-case-when-else-delete-insert-test", + "expectedResult": { + "changes": { + "case-when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 1 + ] + } + }, + "summary": "Deleted an else block in a case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-when-else.rb" + ], + "sha1": "31387a19632065bd797ebae9c680b375b46e72a4", + "gitDir": "test/corpus/repos/ruby", + "sha2": "299fdb0e06b8397dc6fe2ba240ba90134d006a07" +} +,{ + "testCaseDescription": "ruby-case-when-else-replacement-test", + "expectedResult": { + "changes": { + "case-when-else.rb": [ + { + "span": { + "insert": { + "start": [ + 4, + 1 + ], + "end": [ + 6, + 1 + ] + } + }, + "summary": "Added an else block in a case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-when-else.rb" + ], + "sha1": "299fdb0e06b8397dc6fe2ba240ba90134d006a07", + "gitDir": "test/corpus/repos/ruby", + "sha2": "d1c0e2fa239eae1685645481516402d0219bc59e" +} +,{ + "testCaseDescription": "ruby-case-when-else-delete-replacement-test", + "expectedResult": { + "changes": { + "case-when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 10, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + }, + { + "span": { + "insert": { + "start": [ + 5, + 1 + ], + "end": [ + 10, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-when-else.rb" + ], + "sha1": "d1c0e2fa239eae1685645481516402d0219bc59e", + "gitDir": "test/corpus/repos/ruby", + "sha2": "df3f41005b7a453a3eaf77ef4192a25bfa8aee5a" +} +,{ + "testCaseDescription": "ruby-case-when-else-delete-test", + "expectedResult": { + "changes": { + "case-when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 4, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-when-else.rb" + ], + "sha1": "df3f41005b7a453a3eaf77ef4192a25bfa8aee5a", + "gitDir": "test/corpus/repos/ruby", + "sha2": "65383838c56a79f86304217a71799ce62d24e416" +} +,{ + "testCaseDescription": "ruby-case-when-else-delete-rest-test", + "expectedResult": { + "changes": { + "case-when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "case-when-else.rb" + ], + "sha1": "65383838c56a79f86304217a71799ce62d24e416", + "gitDir": "test/corpus/repos/ruby", + "sha2": "f7e62e18ec0e13cd8261dee63a3b1559d6c5c8cd" +}] diff --git a/test/corpus/diff-summaries/ruby/when-else.json b/test/corpus/diff-summaries/ruby/when-else.json new file mode 100644 index 000000000..58e0e4007 --- /dev/null +++ b/test/corpus/diff-summaries/ruby/when-else.json @@ -0,0 +1,262 @@ +[{ + "testCaseDescription": "ruby-when-else-insert-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "sha1": "ec3951c0b3dd8098f16e44db974fe0ae9f54e68e", + "gitDir": "test/corpus/repos/ruby", + "sha2": "3e9490a17aa7b8de8f1b9da8f16936d00f02f3d0" +} +,{ + "testCaseDescription": "ruby-when-else-replacement-insert-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "insert": { + "start": [ + 1, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + }, + { + "span": { + "insert": { + "start": [ + 7, + 1 + ], + "end": [ + 11, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "sha1": "3e9490a17aa7b8de8f1b9da8f16936d00f02f3d0", + "gitDir": "test/corpus/repos/ruby", + "sha2": "6a55992ed83a22acee690724fb27c7602dc203d0" +} +,{ + "testCaseDescription": "ruby-when-else-delete-insert-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 5 + ] + } + }, + "summary": "Deleted the 'qoz' identifier in an else block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "sha1": "6a55992ed83a22acee690724fb27c7602dc203d0", + "gitDir": "test/corpus/repos/ruby", + "sha2": "eb050325465809da02f9eac02d5f0fd58a34e98d" +} +,{ + "testCaseDescription": "ruby-when-else-replacement-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "insert": { + "start": [ + 5, + 2 + ], + "end": [ + 5, + 5 + ] + } + }, + "summary": "Added the 'qoz' identifier in an else block" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "sha1": "eb050325465809da02f9eac02d5f0fd58a34e98d", + "gitDir": "test/corpus/repos/ruby", + "sha2": "2f9667691df40fd129950ae96d504cc9e4a07115" +} +,{ + "testCaseDescription": "ruby-when-else-delete-replacement-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + }, + { + "span": { + "delete": { + "start": [ + 7, + 1 + ], + "end": [ + 11, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + }, + { + "span": { + "insert": { + "start": [ + 6, + 1 + ], + "end": [ + 11, + 4 + ] + } + }, + "summary": "Added the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "sha1": "2f9667691df40fd129950ae96d504cc9e4a07115", + "gitDir": "test/corpus/repos/ruby", + "sha2": "5ddb7b05815111c5f855a8483602e5ed84d7807d" +} +,{ + "testCaseDescription": "ruby-when-else-delete-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 5, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "sha1": "5ddb7b05815111c5f855a8483602e5ed84d7807d", + "gitDir": "test/corpus/repos/ruby", + "sha2": "356a3074b52bae43df83b49366184868aac4ad88" +} +,{ + "testCaseDescription": "ruby-when-else-delete-rest-test", + "expectedResult": { + "changes": { + "when-else.rb": [ + { + "span": { + "delete": { + "start": [ + 1, + 1 + ], + "end": [ + 6, + 4 + ] + } + }, + "summary": "Deleted the 'foo' case statement" + } + ] + }, + "errors": {} + }, + "filePaths": [ + "when-else.rb" + ], + "sha1": "356a3074b52bae43df83b49366184868aac4ad88", + "gitDir": "test/corpus/repos/ruby", + "sha2": "bfca7e21e4be7154bd72a73c426c00bc2596eddc" +}] diff --git a/test/corpus/generated/ruby.json b/test/corpus/generated/ruby.json index 937add7bf..48d9d696c 100644 --- a/test/corpus/generated/ruby.json +++ b/test/corpus/generated/ruby.json @@ -238,6 +238,16 @@ "syntax": "when", "insert": "case foo\nwhen bar\nend", "replacement": "case foo\nwhen bar\n baz\nend" + }, + { + "syntax": "case-when-else", + "insert": "case foo\nwhen bar\n baz\nend", + "replacement": "case foo\nwhen bar\n baz\nelse\n qoz\nend" + }, + { + "syntax": "when-else", + "insert": "case foo\nwhen bar\n baz\nelse\nend", + "replacement": "case foo\nwhen bar\n baz\nelse\n qoz\nend" } ] } diff --git a/test/corpus/repos/ruby b/test/corpus/repos/ruby index ff1229693..bfca7e21e 160000 --- a/test/corpus/repos/ruby +++ b/test/corpus/repos/ruby @@ -1 +1 @@ -Subproject commit ff122969324986ab2efa865790c05098cf5bf7eb +Subproject commit bfca7e21e4be7154bd72a73c426c00bc2596eddc