1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Update tests to include continue, yield and break statements

This commit is contained in:
Rick Winfrey 2016-11-30 18:19:10 -06:00
parent a0fb4e75a7
commit df5bb88c9e
5 changed files with 859 additions and 1 deletions

View File

@ -0,0 +1,292 @@
[{
"testCaseDescription": "javascript-break-setup-test",
"expectedResult": {
"changes": {
"break.js": [
{
"span": {
"insert": {
"start": [
1,
140309233166937
],
"end": [
210453397505,
140309233166937
]
}
},
"summary": "Added the 'i = 0; i < 10; i++' for statement"
}
]
},
"errors": {}
},
"filePaths": [
"break.js"
],
"patch": [
"diff --git a/break.js b/break.js",
"index e69de29..3f583e3 100644",
"--- a/break.js",
"+++ b/break.js",
"@@ -0,0 +1 @@",
"+for (i = 0; i < 10; i++) { if (i === 4) { }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "ea1671cdce0b67e20f5aaad703375f33717b4c4b..29bdaba310da237431a45292e2d6c362debd36c4"
}
,{
"testCaseDescription": "javascript-break-insert-test",
"expectedResult": {
"changes": {
"break.js": [
{
"span": {
"insert": {
"start": [
180388626433,
140309233166937
],
"end": [
206158430209,
140309233166937
]
}
},
"summary": "Added a break statement in the 'i === 4' if statement"
},
{
"span": {
"delete": {
"start": [
171798691841,
140309233166937
],
"end": [
188978561025,
140309233166937
]
}
},
"summary": "Deleted the '{ }' object in the 'i === 4' if statement"
}
]
},
"errors": {}
},
"filePaths": [
"break.js"
],
"patch": [
"diff --git a/break.js b/break.js",
"index 3f583e3..629dfa9 100644",
"--- a/break.js",
"+++ b/break.js",
"@@ -1 +1 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { }; i }",
"+for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "29bdaba310da237431a45292e2d6c362debd36c4..293aa885106964e7556b9dfa98c5382c10b8a6b0"
}
,{
"testCaseDescription": "javascript-break-replacement-test",
"expectedResult": {
"changes": {
"break.js": [
{
"span": {
"insert": {
"start": [
180388626433,
140309233166937
],
"end": [
219043332097,
140309233166937
]
}
},
"summary": "Added a continue statement in the 'i === 4' if statement"
},
{
"span": {
"delete": {
"start": [
180388626433,
140309233166937
],
"end": [
206158430209,
140309233166937
]
}
},
"summary": "Deleted a break statement in the 'i === 4' if statement"
}
]
},
"errors": {}
},
"filePaths": [
"break.js"
],
"patch": [
"diff --git a/break.js b/break.js",
"index 629dfa9..16ebcc5 100644",
"--- a/break.js",
"+++ b/break.js",
"@@ -1 +1 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }",
"+for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "293aa885106964e7556b9dfa98c5382c10b8a6b0..8b2bc68e984b7a6c4e5c6e55e039b0aa40f3f67f"
}
,{
"testCaseDescription": "javascript-break-delete-replacement-test",
"expectedResult": {
"changes": {
"break.js": [
{
"span": {
"insert": {
"start": [
180388626433,
140309233165401
],
"end": [
206158430209,
140309233165401
]
}
},
"summary": "Added a break statement in the 'i === 4' if statement"
},
{
"span": {
"delete": {
"start": [
180388626433,
140309233165401
],
"end": [
219043332097,
140309233165401
]
}
},
"summary": "Deleted a continue statement in the 'i === 4' if statement"
}
]
},
"errors": {}
},
"filePaths": [
"break.js"
],
"patch": [
"diff --git a/break.js b/break.js",
"index 16ebcc5..629dfa9 100644",
"--- a/break.js",
"+++ b/break.js",
"@@ -1 +1 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }",
"+for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "8b2bc68e984b7a6c4e5c6e55e039b0aa40f3f67f..eaec06d694fef5d0e8fa32a802a55389fb8b6c8c"
}
,{
"testCaseDescription": "javascript-break-delete-insert-test",
"expectedResult": {
"changes": {
"break.js": [
{
"span": {
"insert": {
"start": [
171798691841,
140309233165401
],
"end": [
188978561025,
140309233165401
]
}
},
"summary": "Added the '{ }' object in the 'i === 4' if statement"
},
{
"span": {
"delete": {
"start": [
180388626433,
140309233165401
],
"end": [
206158430209,
140309233165401
]
}
},
"summary": "Deleted a break statement in the 'i === 4' if statement"
}
]
},
"errors": {}
},
"filePaths": [
"break.js"
],
"patch": [
"diff --git a/break.js b/break.js",
"index 629dfa9..3f583e3 100644",
"--- a/break.js",
"+++ b/break.js",
"@@ -1 +1 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }",
"+for (i = 0; i < 10; i++) { if (i === 4) { }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "eaec06d694fef5d0e8fa32a802a55389fb8b6c8c..7ddcffc3c365f13d59cc905f9e578bdca274f5dd"
}
,{
"testCaseDescription": "javascript-break-teardown-test",
"expectedResult": {
"changes": {
"break.js": [
{
"span": {
"delete": {
"start": [
1,
140309233166937
],
"end": [
210453397505,
140309233166937
]
}
},
"summary": "Deleted the 'i = 0; i < 10; i++' for statement"
}
]
},
"errors": {}
},
"filePaths": [
"break.js"
],
"patch": [
"diff --git a/break.js b/break.js",
"index 3f583e3..e69de29 100644",
"--- a/break.js",
"+++ b/break.js",
"@@ -1 +0,0 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "7ddcffc3c365f13d59cc905f9e578bdca274f5dd..46d6a3457c914d00af457365985e69ec0285fcc9"
}]

View File

@ -0,0 +1,292 @@
[{
"testCaseDescription": "javascript-continue-setup-test",
"expectedResult": {
"changes": {
"continue.js": [
{
"span": {
"insert": {
"start": [
1,
140309233165401
],
"end": [
210453397505,
140309233165401
]
}
},
"summary": "Added the 'i = 0; i < 10; i++' for statement"
}
]
},
"errors": {}
},
"filePaths": [
"continue.js"
],
"patch": [
"diff --git a/continue.js b/continue.js",
"index e69de29..3f583e3 100644",
"--- a/continue.js",
"+++ b/continue.js",
"@@ -0,0 +1 @@",
"+for (i = 0; i < 10; i++) { if (i === 4) { }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "46d6a3457c914d00af457365985e69ec0285fcc9..7ced860008d47345013ea11ef4f626ae9d4dc36a"
}
,{
"testCaseDescription": "javascript-continue-insert-test",
"expectedResult": {
"changes": {
"continue.js": [
{
"span": {
"insert": {
"start": [
180388626433,
140309233166937
],
"end": [
219043332097,
140309233166937
]
}
},
"summary": "Added a continue statement in the 'i === 4' if statement"
},
{
"span": {
"delete": {
"start": [
171798691841,
140309233166937
],
"end": [
188978561025,
140309233166937
]
}
},
"summary": "Deleted the '{ }' object in the 'i === 4' if statement"
}
]
},
"errors": {}
},
"filePaths": [
"continue.js"
],
"patch": [
"diff --git a/continue.js b/continue.js",
"index 3f583e3..16ebcc5 100644",
"--- a/continue.js",
"+++ b/continue.js",
"@@ -1 +1 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { }; i }",
"+for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "7ced860008d47345013ea11ef4f626ae9d4dc36a..614cbeeb50b695a633880cf2553142cd0c135df1"
}
,{
"testCaseDescription": "javascript-continue-replacement-test",
"expectedResult": {
"changes": {
"continue.js": [
{
"span": {
"insert": {
"start": [
180388626433,
140309233166937
],
"end": [
206158430209,
140309233166937
]
}
},
"summary": "Added a break statement in the 'i === 4' if statement"
},
{
"span": {
"delete": {
"start": [
180388626433,
140309233166937
],
"end": [
219043332097,
140309233166937
]
}
},
"summary": "Deleted a continue statement in the 'i === 4' if statement"
}
]
},
"errors": {}
},
"filePaths": [
"continue.js"
],
"patch": [
"diff --git a/continue.js b/continue.js",
"index 16ebcc5..629dfa9 100644",
"--- a/continue.js",
"+++ b/continue.js",
"@@ -1 +1 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }",
"+for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "614cbeeb50b695a633880cf2553142cd0c135df1..256c599e2dd35a69844749098414c140727f798a"
}
,{
"testCaseDescription": "javascript-continue-delete-replacement-test",
"expectedResult": {
"changes": {
"continue.js": [
{
"span": {
"insert": {
"start": [
180388626433,
140309233166937
],
"end": [
219043332097,
140309233166937
]
}
},
"summary": "Added a continue statement in the 'i === 4' if statement"
},
{
"span": {
"delete": {
"start": [
180388626433,
140309233166937
],
"end": [
206158430209,
140309233166937
]
}
},
"summary": "Deleted a break statement in the 'i === 4' if statement"
}
]
},
"errors": {}
},
"filePaths": [
"continue.js"
],
"patch": [
"diff --git a/continue.js b/continue.js",
"index 629dfa9..16ebcc5 100644",
"--- a/continue.js",
"+++ b/continue.js",
"@@ -1 +1 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { break; }; i }",
"+for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "256c599e2dd35a69844749098414c140727f798a..a4306264878d23f2d09e1889d6edf16bd78d91c9"
}
,{
"testCaseDescription": "javascript-continue-delete-insert-test",
"expectedResult": {
"changes": {
"continue.js": [
{
"span": {
"insert": {
"start": [
171798691841,
140309233165401
],
"end": [
188978561025,
140309233165401
]
}
},
"summary": "Added the '{ }' object in the 'i === 4' if statement"
},
{
"span": {
"delete": {
"start": [
180388626433,
140309233165401
],
"end": [
219043332097,
140309233165401
]
}
},
"summary": "Deleted a continue statement in the 'i === 4' if statement"
}
]
},
"errors": {}
},
"filePaths": [
"continue.js"
],
"patch": [
"diff --git a/continue.js b/continue.js",
"index 16ebcc5..3f583e3 100644",
"--- a/continue.js",
"+++ b/continue.js",
"@@ -1 +1 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { continue; }; i }",
"+for (i = 0; i < 10; i++) { if (i === 4) { }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "a4306264878d23f2d09e1889d6edf16bd78d91c9..fee7adbc882ac10d266290a0a97e7067aae77bdc"
}
,{
"testCaseDescription": "javascript-continue-teardown-test",
"expectedResult": {
"changes": {
"continue.js": [
{
"span": {
"delete": {
"start": [
1,
140309233165401
],
"end": [
210453397505,
140309233165401
]
}
},
"summary": "Deleted the 'i = 0; i < 10; i++' for statement"
}
]
},
"errors": {}
},
"filePaths": [
"continue.js"
],
"patch": [
"diff --git a/continue.js b/continue.js",
"index 3f583e3..e69de29 100644",
"--- a/continue.js",
"+++ b/continue.js",
"@@ -1 +0,0 @@",
"-for (i = 0; i < 10; i++) { if (i === 4) { }; i }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "fee7adbc882ac10d266290a0a97e7067aae77bdc..b3763c3149f8c1be111030670500c941cc56670a"
}]

View File

@ -0,0 +1,256 @@
[{
"testCaseDescription": "javascript-yield-setup-test",
"expectedResult": {
"changes": {
"yield.js": [
{
"span": {
"insert": {
"start": [
1,
140309233165401
],
"end": [
146028888065,
140309233165401
]
}
},
"summary": "Added the 'foo' function"
}
]
},
"errors": {}
},
"filePaths": [
"yield.js"
],
"patch": [
"diff --git a/yield.js b/yield.js",
"index e69de29..e01b17c 100644",
"--- a/yield.js",
"+++ b/yield.js",
"@@ -0,0 +1 @@",
"+function* foo(){ var index = 0; }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "b3763c3149f8c1be111030670500c941cc56670a..7cb37fa3eaa135398a8cfcfe6bf281754bfc0968"
}
,{
"testCaseDescription": "javascript-yield-insert-test",
"expectedResult": {
"changes": {
"yield.js": [
{
"span": {
"insert": {
"start": [
137438953473,
140309233165401
],
"end": [
171798691841,
140309233165401
]
}
},
"summary": "Added the 'i' yield statement in the foo function"
}
]
},
"errors": {}
},
"filePaths": [
"yield.js"
],
"patch": [
"diff --git a/yield.js b/yield.js",
"index e01b17c..e208816 100644",
"--- a/yield.js",
"+++ b/yield.js",
"@@ -1 +1 @@",
"-function* foo(){ var index = 0; }",
"+function* foo(){ var index = 0; yield i; }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "7cb37fa3eaa135398a8cfcfe6bf281754bfc0968..2ce8ab9c8f3f1975fd6e15da11be73029b456129"
}
,{
"testCaseDescription": "javascript-yield-replacement-test",
"expectedResult": {
"changes": {
"yield.js": [
{
"span": {
"replace": [
{
"start": [
137438953473,
140309233166937
],
"end": [
171798691841,
140309233166937
]
},
{
"start": [
137438953473,
140309233166937
],
"end": [
180388626433,
140309233166937
]
}
]
},
"summary": "Replaced the 'i' yield statement with the 'i++' yield statement in the foo function"
}
]
},
"errors": {}
},
"filePaths": [
"yield.js"
],
"patch": [
"diff --git a/yield.js b/yield.js",
"index e208816..78ab2ef 100644",
"--- a/yield.js",
"+++ b/yield.js",
"@@ -1 +1 @@",
"-function* foo(){ var index = 0; yield i; }",
"+function* foo(){ var index = 0; yield i++; }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "2ce8ab9c8f3f1975fd6e15da11be73029b456129..a9f3ad1c74e63fc863dd3661258f1aeb4c2ee0f1"
}
,{
"testCaseDescription": "javascript-yield-delete-replacement-test",
"expectedResult": {
"changes": {
"yield.js": [
{
"span": {
"replace": [
{
"start": [
137438953473,
140309233165401
],
"end": [
180388626433,
140309233165401
]
},
{
"start": [
137438953473,
140309233165401
],
"end": [
171798691841,
140309233165401
]
}
]
},
"summary": "Replaced the 'i++' yield statement with the 'i' yield statement in the foo function"
}
]
},
"errors": {}
},
"filePaths": [
"yield.js"
],
"patch": [
"diff --git a/yield.js b/yield.js",
"index 78ab2ef..e208816 100644",
"--- a/yield.js",
"+++ b/yield.js",
"@@ -1 +1 @@",
"-function* foo(){ var index = 0; yield i++; }",
"+function* foo(){ var index = 0; yield i; }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "a9f3ad1c74e63fc863dd3661258f1aeb4c2ee0f1..699cdda771dbc5719b1abd5155622a2520916842"
}
,{
"testCaseDescription": "javascript-yield-delete-insert-test",
"expectedResult": {
"changes": {
"yield.js": [
{
"span": {
"delete": {
"start": [
137438953473,
140309233165401
],
"end": [
171798691841,
140309233165401
]
}
},
"summary": "Deleted the 'i' yield statement in the foo function"
}
]
},
"errors": {}
},
"filePaths": [
"yield.js"
],
"patch": [
"diff --git a/yield.js b/yield.js",
"index e208816..e01b17c 100644",
"--- a/yield.js",
"+++ b/yield.js",
"@@ -1 +1 @@",
"-function* foo(){ var index = 0; yield i; }",
"+function* foo(){ var index = 0; }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "699cdda771dbc5719b1abd5155622a2520916842..cac9c5a63ec0402053dbf61bb279288fdc73f212"
}
,{
"testCaseDescription": "javascript-yield-teardown-test",
"expectedResult": {
"changes": {
"yield.js": [
{
"span": {
"delete": {
"start": [
1,
140309233165401
],
"end": [
146028888065,
140309233165401
]
}
},
"summary": "Deleted the 'foo' function"
}
]
},
"errors": {}
},
"filePaths": [
"yield.js"
],
"patch": [
"diff --git a/yield.js b/yield.js",
"index e01b17c..e69de29 100644",
"--- a/yield.js",
"+++ b/yield.js",
"@@ -1 +0,0 @@",
"-function* foo(){ var index = 0; }"
],
"gitDir": "test/corpus/repos/javascript",
"shas": "cac9c5a63ec0402053dbf61bb279288fdc73f212..5c6bdce8f72c2d775feff2e1e2bafd6639ec3092"
}]

View File

@ -308,6 +308,24 @@
"syntax": "export",
"insert": "export { name1, name2, name3, nameN };\nexport { variable1 as name1, variable2 as name2, nameN };\nexport let name1, name2, nameN;\nexport let name1 = value1, name2 = value2, name3, nameN;\nexport default namedFunction;\nexport default function () { };\nexport default function name1() { };\nexport { name1 as default };\nexport * from 'foo';\nexport { name1, name2, nameN } from 'foo';\nexport { import1 as name1, import2 as name2, nameN } from 'bar';",
"replacement": "export { name4, name5, name6, nameZ };\nexport { variable2 as name2, variable3 as name3, nameY };\nexport let name3, name4, nameT;\nexport let name2 = value2, name3 = value3, name4, nameO;\nexport default otherNamedFunction;\nexport default function newName1() {};\nexport default function () {};\nexport { name2 as statement };\nexport * from 'baz';\nexport { name7, name8, nameP } from 'buzz';\nexport { import6 as name6, import7 as name7, nameB } from 'fizz';"
},
{
"syntax": "break",
"insert": "break;",
"replacement": "continue;",
"template": "for (i = 0; i < 10; i++) { if (i === 4) { {0} }; i }"
},
{
"syntax": "continue",
"insert": "continue;",
"replacement": "break;",
"template": "for (i = 0; i < 10; i++) { if (i === 4) { {0} }; i }"
},
{
"syntax": "yield",
"insert": "yield i;",
"replacement": "yield i++;",
"template": "function* foo(){ var index = 0; {0} }"
}
]
}

@ -1 +1 @@
Subproject commit ba01e3794a8efa31353fd2d5726c70bb2ad8c6a8
Subproject commit 5c6bdce8f72c2d775feff2e1e2bafd6639ec3092