1
1
mirror of https://github.com/github/semantic.git synced 2025-01-01 19:55:34 +03:00
semantic/test/corpus/generated/go.json
2016-11-01 22:05:43 -04:00

87 lines
3.7 KiB
JSON

[
{
"repoUrl": "https://github.com/joshvera/go.git",
"language": "go",
"fileExt": ".go",
"templateText": "package main\n",
"syntaxes": [
{
"syntax": "imports",
"repoFilePath": "imports",
"insert": "import \"net/http\"\nimport . \"some/dsl\"\nimport alias \"some/package\"",
"testCaseFilePath": "test/corpus/diff-summaries/go/imports.json",
"replacement": "import \"foo/bar\"\nimport . \"types/dsl\"\nimport alias \"awesome/packages\""
},
{
"syntax": "int-literal",
"repoFilePath": "int-literal.go",
"insert": "const (\na = 1, b = 2, c = 3\n)",
"testCaseFilePath": "test/corpus/diff-summaries/go/int-literal.json",
"replacement": "const (\na = 4, b = 5, c = 6\n)"
},
{
"syntax": "assignment",
"repoFilePath": "assignment.go",
"insert": "var foo int = 42",
"testCaseFilePath": "test/corpus/diff-summaries/go/assignment.json",
"replacement": "var bar string = \"hello\""
},
{
"syntax": "function-call",
"repoFilePath": "function-call.go",
"insert": "a()",
"testCaseFilePath": "test/corpus/diff-summaries/go/function-call.json",
"replacement": "b()"
},
{
"syntax": "function-literal",
"repoFilePath": "function-literal.go",
"insert": "const s1 = func(s string) (int, int) {\nreturn 1, 2\n}",
"testCaseFilePath": "test/corpus/diff-summaries/go/function-literal.json",
"replacement": "const s1 = func(b int) (string, string) {\nreturn 1, 2\n}"
},
{
"syntax": "const-declarations",
"repoFilePath": "const-declarations.go",
"insert": "const zero = 0",
"testCaseFilePath": "test/corpus/diff-summaries/go/const-declarations.json",
"replacement": "const one, two = 1, 2"
},
{
"syntax": "var-declarations",
"repoFilePath": "var-declarations.go",
"insert": "var zero = 0",
"testCaseFilePath": "test/corpus/diff-summaries/go/var-declarations.json",
"replacement": "var one, two = 1, 2"
},
{
"syntax": "var-declarations",
"repoFilePath": "var-declarations.go",
"insert": "var zero = 0",
"testCaseFilePath": "test/corpus/diff-summaries/go/var-declarations.json",
"replacement": "var one, two = 1, 2"
},
{
"syntax": "switch-statements",
"repoFilePath": "switch-statements.go",
"insert": "switch { case x < y: f1()\ncase x < z: g()\ncase x == 4: h()\n}",
"testCaseFilePath": "test/corpus/diff-summaries/go/var-declarations.json",
"replacement": "switch { case a < b: f1()\ncase c < d: g()\ncase e == 4: f()\n}"
},
{
"syntax": "for-statements",
"repoFilePath": "for-statements.go",
"insert": "for { case x < y: f1()\ncase x < z: g()\ncase x == 4: h()\n}",
"testCaseFilePath": "test/corpus/diff-summaries/go/var-declarations.json",
"replacement": "func main() { for { a() goto loop }\nloop: for i := 0; i < 5; i++\n{ a()\nbreak loop\n}\nloop2: for ; i < 10; i++ \n{ \na()\ncontinue loop2\n}\nfor ;; { a() continue }\nfor x := range y { a(x)\nbreak }\n}"
},
{
"syntax": "function-declarations",
"repoFilePath": "function-declarations.go",
"testCaseFilePath": "test/corpus/diff-summaries/go/function-declarations.json",
"insert": "func f1() {}\nfunc f2(a int, b, c, d string) int {}\nfunc f2() (int, error) {}\nfunc f2() (result int, err error) {}",
"replacement": "func fa() {}\nfunc fb(a int, b, c, d string) int {}\nfunc fc() (int, error) {}\nfunc fd() (result int, err error) {}"
}
]
}
]