-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
55 lines (44 loc) · 1.24 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"fmt"
"log"
mainApp "graphql-go/compatibility-unit-tests/app"
"graphql-go/compatibility-unit-tests/cmd"
"graphql-go/compatibility-unit-tests/implementation"
"graphql-go/compatibility-unit-tests/result"
)
var choices = []string{}
func init() {
for _, i := range implementation.Implementations {
choices = append(choices, i.Repo.String(implementation.ImplementationPrefix))
}
}
func main() {
cli := cmd.CLI{}
header := implementation.RefImplementation.Repo.String(implementation.RefImplementationPrefix)
cliResult, err := cli.Run(&cmd.RunParams{
Choices: choices,
Header: header,
})
if err != nil {
log.Fatal(err)
}
currentImplementation, ok := implementation.ImplementationsMap[cliResult.Choice]
if !ok {
log.Fatal(fmt.Errorf("expected to find the following implementation: %v", cliResult.Choice))
}
app := mainApp.App{}
r, err := app.Run(mainApp.AppParams{
Implementation: currentImplementation,
RefImplementation: implementation.GraphqlJSImplementation,
})
if err != nil {
log.Fatal(err)
}
summaryParams := &result.SummaryParams{
SuccessfulTests: len(r.SuccessfulTests),
FailedTests: len(r.FailedTests),
}
result := result.Result{}
fmt.Println(result.Summary(summaryParams))
}