1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Improve begin and when testing

This commit is contained in:
Timothy Clem 2016-11-03 13:11:02 -07:00
parent c02dbb071f
commit 8df2dca93b
7 changed files with 148 additions and 837 deletions

View File

@ -1,262 +0,0 @@
[{
"testCaseDescription": "ruby-begin-else-insert-test",
"expectedResult": {
"changes": {
"begin-else.rb": [
{
"span": {
"insert": {
"start": [
1,
1
],
"end": [
3,
4
]
}
},
"summary": "Added a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"begin-else.rb"
],
"sha1": "92906a8fecac8451a93d006f532f99903d75f756",
"gitDir": "test/corpus/repos/ruby",
"sha2": "373027785f09b73e0f8701167c810ba3dabb9ac8"
}
,{
"testCaseDescription": "ruby-begin-else-replacement-insert-test",
"expectedResult": {
"changes": {
"begin-else.rb": [
{
"span": {
"insert": {
"start": [
1,
1
],
"end": [
5,
4
]
}
},
"summary": "Added a begin statement"
},
{
"span": {
"insert": {
"start": [
6,
1
],
"end": [
8,
4
]
}
},
"summary": "Added a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"begin-else.rb"
],
"sha1": "373027785f09b73e0f8701167c810ba3dabb9ac8",
"gitDir": "test/corpus/repos/ruby",
"sha2": "b95c073afcbd94fc7b26ba3b6120e845504a0906"
}
,{
"testCaseDescription": "ruby-begin-else-delete-insert-test",
"expectedResult": {
"changes": {
"begin-else.rb": [
{
"span": {
"delete": {
"start": [
3,
1
],
"end": [
5,
1
]
}
},
"summary": "Deleted an else block in a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"begin-else.rb"
],
"sha1": "b95c073afcbd94fc7b26ba3b6120e845504a0906",
"gitDir": "test/corpus/repos/ruby",
"sha2": "50bbf77e12e055a10a18777d5cd0d64cba07dd41"
}
,{
"testCaseDescription": "ruby-begin-else-replacement-test",
"expectedResult": {
"changes": {
"begin-else.rb": [
{
"span": {
"insert": {
"start": [
3,
1
],
"end": [
5,
1
]
}
},
"summary": "Added an else block in a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"begin-else.rb"
],
"sha1": "50bbf77e12e055a10a18777d5cd0d64cba07dd41",
"gitDir": "test/corpus/repos/ruby",
"sha2": "e2663b44ae83e64287df918ff156539aebb906de"
}
,{
"testCaseDescription": "ruby-begin-else-delete-replacement-test",
"expectedResult": {
"changes": {
"begin-else.rb": [
{
"span": {
"delete": {
"start": [
1,
1
],
"end": [
5,
4
]
}
},
"summary": "Deleted a begin statement"
},
{
"span": {
"delete": {
"start": [
6,
1
],
"end": [
8,
4
]
}
},
"summary": "Deleted a begin statement"
},
{
"span": {
"insert": {
"start": [
4,
1
],
"end": [
8,
4
]
}
},
"summary": "Added a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"begin-else.rb"
],
"sha1": "e2663b44ae83e64287df918ff156539aebb906de",
"gitDir": "test/corpus/repos/ruby",
"sha2": "531e205bd89e49f2b24effc365320f25fbde600e"
}
,{
"testCaseDescription": "ruby-begin-else-delete-test",
"expectedResult": {
"changes": {
"begin-else.rb": [
{
"span": {
"delete": {
"start": [
1,
1
],
"end": [
3,
4
]
}
},
"summary": "Deleted a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"begin-else.rb"
],
"sha1": "531e205bd89e49f2b24effc365320f25fbde600e",
"gitDir": "test/corpus/repos/ruby",
"sha2": "2f2adf17406f548e989464cf6cfe811d75b2dfcb"
}
,{
"testCaseDescription": "ruby-begin-else-delete-rest-test",
"expectedResult": {
"changes": {
"begin-else.rb": [
{
"span": {
"delete": {
"start": [
1,
1
],
"end": [
5,
4
]
}
},
"summary": "Deleted a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"begin-else.rb"
],
"sha1": "2f2adf17406f548e989464cf6cfe811d75b2dfcb",
"gitDir": "test/corpus/repos/ruby",
"sha2": "6592554e576fcb7805c20f575575bcc05f96d450"
}]

View File

@ -1,4 +1,35 @@
[{
"testCaseDescription": "ruby-else-setup-test",
"expectedResult": {
"changes": {
"else.rb": [
{
"span": {
"insert": {
"start": [
1,
1
],
"end": [
3,
4
]
}
},
"summary": "Added a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"else.rb"
],
"sha1": "185f388c63b93f9018e84d711803adf1636308ae",
"gitDir": "test/corpus/repos/ruby",
"sha2": "e2fc31372d94660e3d757b5264a776be67da4e38"
}
,{
"testCaseDescription": "ruby-else-insert-test",
"expectedResult": {
"changes": {
@ -7,16 +38,16 @@
"span": {
"insert": {
"start": [
1,
3,
1
],
"end": [
4,
4
3,
5
]
}
},
"summary": "Added a begin statement"
"summary": "Added an else block in a begin statement"
}
]
},
@ -25,86 +56,9 @@
"filePaths": [
"else.rb"
],
"sha1": "264e8a80aee14d0effd8b560eba0b756fc977f49",
"sha1": "e2fc31372d94660e3d757b5264a776be67da4e38",
"gitDir": "test/corpus/repos/ruby",
"sha2": "f94104abf315362c00c98ec8983bc10c015f423e"
}
,{
"testCaseDescription": "ruby-else-replacement-insert-test",
"expectedResult": {
"changes": {
"else.rb": [
{
"span": {
"insert": {
"start": [
1,
1
],
"end": [
5,
4
]
}
},
"summary": "Added a begin statement"
},
{
"span": {
"insert": {
"start": [
6,
1
],
"end": [
9,
4
]
}
},
"summary": "Added a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"else.rb"
],
"sha1": "f94104abf315362c00c98ec8983bc10c015f423e",
"gitDir": "test/corpus/repos/ruby",
"sha2": "416c6e8a826c994180e96da45cfc165a9ad39998"
}
,{
"testCaseDescription": "ruby-else-delete-insert-test",
"expectedResult": {
"changes": {
"else.rb": [
{
"span": {
"delete": {
"start": [
4,
3
],
"end": [
4,
8
]
}
},
"summary": "Deleted the 'bar()' function call in an else block"
}
]
},
"errors": {}
},
"filePaths": [
"else.rb"
],
"sha1": "416c6e8a826c994180e96da45cfc165a9ad39998",
"gitDir": "test/corpus/repos/ruby",
"sha2": "1309e64764df58212ef4e2ae14dd40b6e213ad6e"
"sha2": "d767bcf390d01661e9055a2f29a6657e3f2ab689"
}
,{
"testCaseDescription": "ruby-else-replacement-test",
@ -133,9 +87,9 @@
"filePaths": [
"else.rb"
],
"sha1": "1309e64764df58212ef4e2ae14dd40b6e213ad6e",
"sha1": "d767bcf390d01661e9055a2f29a6657e3f2ab689",
"gitDir": "test/corpus/repos/ruby",
"sha2": "57b4e2e412d9b1fdd7b78db5fadcac2264d0a8f1"
"sha2": "bc85fe626575dac5acb16e87a60627a0119f03d7"
}
,{
"testCaseDescription": "ruby-else-delete-replacement-test",
@ -146,77 +100,16 @@
"span": {
"delete": {
"start": [
1,
1
],
"end": [
5,
4
]
}
},
"summary": "Deleted a begin statement"
},
{
"span": {
"delete": {
"start": [
6,
1
],
"end": [
9,
4
]
}
},
"summary": "Deleted a begin statement"
},
{
"span": {
"insert": {
"start": [
5,
1
],
"end": [
9,
4
]
}
},
"summary": "Added a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"else.rb"
],
"sha1": "57b4e2e412d9b1fdd7b78db5fadcac2264d0a8f1",
"gitDir": "test/corpus/repos/ruby",
"sha2": "bdfec68ee7acf98cfa10de9f46bcf3891f030f66"
}
,{
"testCaseDescription": "ruby-else-delete-test",
"expectedResult": {
"changes": {
"else.rb": [
{
"span": {
"delete": {
"start": [
1,
1
4,
3
],
"end": [
4,
4
8
]
}
},
"summary": "Deleted a begin statement"
"summary": "Deleted the 'bar()' function call in an else block"
}
]
},
@ -225,12 +118,43 @@
"filePaths": [
"else.rb"
],
"sha1": "bdfec68ee7acf98cfa10de9f46bcf3891f030f66",
"sha1": "bc85fe626575dac5acb16e87a60627a0119f03d7",
"gitDir": "test/corpus/repos/ruby",
"sha2": "24bbe6d5af40f9c36cdb928aeaa925da59b6a498"
"sha2": "d31b7dd1d21ef27dd0ec35c9543bcd0a4abe11c1"
}
,{
"testCaseDescription": "ruby-else-delete-rest-test",
"testCaseDescription": "ruby-else-delete-insert-test",
"expectedResult": {
"changes": {
"else.rb": [
{
"span": {
"delete": {
"start": [
3,
1
],
"end": [
3,
5
]
}
},
"summary": "Deleted an else block in a begin statement"
}
]
},
"errors": {}
},
"filePaths": [
"else.rb"
],
"sha1": "d31b7dd1d21ef27dd0ec35c9543bcd0a4abe11c1",
"gitDir": "test/corpus/repos/ruby",
"sha2": "0751a900aa120d758b0fc61918d6a3d50e89cff1"
}
,{
"testCaseDescription": "ruby-else-teardown-test",
"expectedResult": {
"changes": {
"else.rb": [
@ -242,7 +166,7 @@
1
],
"end": [
5,
3,
4
]
}
@ -256,7 +180,7 @@
"filePaths": [
"else.rb"
],
"sha1": "24bbe6d5af40f9c36cdb928aeaa925da59b6a498",
"sha1": "0751a900aa120d758b0fc61918d6a3d50e89cff1",
"gitDir": "test/corpus/repos/ruby",
"sha2": "47b6616835e1b178e9cd9191c1259fcfcbb7aab3"
"sha2": "c1aa0372df373a9df1f3c5c38088bacc3b638fbb"
}]

View File

@ -1,262 +0,0 @@
[{
"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"
}]

View File

@ -1,4 +1,35 @@
[{
"testCaseDescription": "ruby-when-setup-test",
"expectedResult": {
"changes": {
"when.rb": [
{
"span": {
"insert": {
"start": [
1,
1
],
"end": [
2,
4
]
}
},
"summary": "Added the 'foo' case statement"
}
]
},
"errors": {}
},
"filePaths": [
"when.rb"
],
"sha1": "c1aa0372df373a9df1f3c5c38088bacc3b638fbb",
"gitDir": "test/corpus/repos/ruby",
"sha2": "5fb46e0291f509dd6478ec4a95919740260e2682"
}
,{
"testCaseDescription": "ruby-when-insert-test",
"expectedResult": {
"changes": {
@ -7,16 +38,16 @@
"span": {
"insert": {
"start": [
1,
2,
1
],
"end": [
3,
4
1
]
}
},
"summary": "Added the 'foo' case statement"
"summary": "Added the 'bar' when comparison in the 'foo' case statement"
}
]
},
@ -25,86 +56,9 @@
"filePaths": [
"when.rb"
],
"sha1": "7699a00ae4f2db5a3570048f56b83158c513a7e1",
"sha1": "5fb46e0291f509dd6478ec4a95919740260e2682",
"gitDir": "test/corpus/repos/ruby",
"sha2": "c27a43cc441ebb84e2fecd86ad9569bda89b6f66"
}
,{
"testCaseDescription": "ruby-when-replacement-insert-test",
"expectedResult": {
"changes": {
"when.rb": [
{
"span": {
"insert": {
"start": [
1,
1
],
"end": [
4,
4
]
}
},
"summary": "Added the 'foo' case statement"
},
{
"span": {
"insert": {
"start": [
5,
1
],
"end": [
7,
4
]
}
},
"summary": "Added the 'foo' case statement"
}
]
},
"errors": {}
},
"filePaths": [
"when.rb"
],
"sha1": "c27a43cc441ebb84e2fecd86ad9569bda89b6f66",
"gitDir": "test/corpus/repos/ruby",
"sha2": "7d9e6213787892e24789ffd2ff01cde77d7ae296"
}
,{
"testCaseDescription": "ruby-when-delete-insert-test",
"expectedResult": {
"changes": {
"when.rb": [
{
"span": {
"delete": {
"start": [
3,
3
],
"end": [
3,
6
]
}
},
"summary": "Deleted the 'baz' identifier in a when comparison"
}
]
},
"errors": {}
},
"filePaths": [
"when.rb"
],
"sha1": "7d9e6213787892e24789ffd2ff01cde77d7ae296",
"gitDir": "test/corpus/repos/ruby",
"sha2": "c41aa9aae0ac7962a4424529f5fc7979c5981ba0"
"sha2": "998ea776459e452dd5056605237ceb22c36846b1"
}
,{
"testCaseDescription": "ruby-when-replacement-test",
@ -133,9 +87,9 @@
"filePaths": [
"when.rb"
],
"sha1": "c41aa9aae0ac7962a4424529f5fc7979c5981ba0",
"sha1": "998ea776459e452dd5056605237ceb22c36846b1",
"gitDir": "test/corpus/repos/ruby",
"sha2": "9e3e5119a2fd787bd1d50679f739811a95258a95"
"sha2": "9a49ec9031437eae17e82bf50a9ebe7f594585d5"
}
,{
"testCaseDescription": "ruby-when-delete-replacement-test",
@ -146,46 +100,16 @@
"span": {
"delete": {
"start": [
1,
1
3,
3
],
"end": [
4,
4
3,
6
]
}
},
"summary": "Deleted the 'foo' case statement"
},
{
"span": {
"delete": {
"start": [
5,
1
],
"end": [
7,
4
]
}
},
"summary": "Deleted the 'foo' case statement"
},
{
"span": {
"insert": {
"start": [
4,
1
],
"end": [
7,
4
]
}
},
"summary": "Added the 'foo' case statement"
"summary": "Deleted the 'baz' identifier in a when comparison"
}
]
},
@ -194,12 +118,12 @@
"filePaths": [
"when.rb"
],
"sha1": "9e3e5119a2fd787bd1d50679f739811a95258a95",
"sha1": "9a49ec9031437eae17e82bf50a9ebe7f594585d5",
"gitDir": "test/corpus/repos/ruby",
"sha2": "6b668407a0448f0bc0d1390c7a9d5a27d894c0fb"
"sha2": "e377ba38188bc00279e3e687d0ee767aedcfb25d"
}
,{
"testCaseDescription": "ruby-when-delete-test",
"testCaseDescription": "ruby-when-delete-insert-test",
"expectedResult": {
"changes": {
"when.rb": [
@ -207,16 +131,16 @@
"span": {
"delete": {
"start": [
1,
2,
1
],
"end": [
3,
4
1
]
}
},
"summary": "Deleted the 'foo' case statement"
"summary": "Deleted the 'bar' when comparison in the 'foo' case statement"
}
]
},
@ -225,12 +149,12 @@
"filePaths": [
"when.rb"
],
"sha1": "6b668407a0448f0bc0d1390c7a9d5a27d894c0fb",
"sha1": "e377ba38188bc00279e3e687d0ee767aedcfb25d",
"gitDir": "test/corpus/repos/ruby",
"sha2": "46deadb9ce696bf99314411f7cf56519dc9d9a03"
"sha2": "50d8aab92b52837ff04e6f7c22f4f2e8da553cd1"
}
,{
"testCaseDescription": "ruby-when-delete-rest-test",
"testCaseDescription": "ruby-when-teardown-test",
"expectedResult": {
"changes": {
"when.rb": [
@ -242,7 +166,7 @@
1
],
"end": [
4,
2,
4
]
}
@ -256,7 +180,7 @@
"filePaths": [
"when.rb"
],
"sha1": "46deadb9ce696bf99314411f7cf56519dc9d9a03",
"sha1": "50d8aab92b52837ff04e6f7c22f4f2e8da553cd1",
"gitDir": "test/corpus/repos/ruby",
"sha2": "ff122969324986ab2efa865790c05098cf5bf7eb"
"sha2": "4271016dbb96667635e707fced1ae9261e704536"
}]

View File

@ -5,10 +5,10 @@
"repoUrl": "https://github.com/diff-fixtures/ruby.git",
"syntaxes": [
{
"template": "if bar\n foo()\n{0}end",
"syntax": "elsif",
"insert": "elsif baz\n",
"replacement": "elsif baz\n qoz()\n"
"syntax": "when",
"template": "case foo\n{0}end",
"insert": "when bar\n",
"replacement": "when bar\n baz\n"
}
]
}

View File

@ -184,30 +184,21 @@
"insert": "foo[bar]\nfoo[:bar]\nfoo[bar] = 1",
"replacement": "x[\"b\"]\nx[:\"c\"]"
},
{
"syntax": "begin",
"insert": "begin\nend",
"replacement": "begin\n foo()\nend"
},
{
"syntax": "begin-else",
"insert": "begin\n foo()\nend",
"replacement": "begin\n foo()\nelse\n bar()\nend"
},
{
"syntax": "else",
"insert": "begin\n foo()\nelse\nend",
"replacement": "begin\n foo()\nelse\n bar()\nend"
"template": "begin\n foo()\n{0}end",
"insert": "else\n",
"replacement": "else\n bar()\n"
},
{
"template": "if bar\n foo()\n{0}end",
"syntax": "elsif",
"template": "if bar\n foo()\n{0}end",
"insert": "elsif baz\n",
"replacement": "elsif baz\n qoz()\n"
},
{
"template": "begin\n foo\n{0}end",
"syntax": "ensure",
"template": "begin\n foo\n{0}end",
"insert": "ensure\n",
"replacement": "ensure\n bar\n"
},
@ -241,15 +232,11 @@
"insert": "foo rescue nil",
"replacement": "bar rescue nil"
},
{
"syntax": "case-when",
"insert": "case foo\nend",
"replacement": "case foo\nwhen bar\nend"
},
{
"syntax": "when",
"insert": "case foo\nwhen bar\nend",
"replacement": "case foo\nwhen bar\n baz\nend"
"template": "case foo\n{0}end",
"insert": "when bar\n",
"replacement": "when bar\n baz\n"
},
{
"syntax": "case-when-else",

@ -1 +1 @@
Subproject commit 185f388c63b93f9018e84d711803adf1636308ae
Subproject commit 4271016dbb96667635e707fced1ae9261e704536