49 строки
1,4 КиБ
Go
49 строки
1,4 КиБ
Go
package ast
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"git.golang1.ru/softonik/godog"
|
|
"git.golang1.ru/softonik/godog/colors"
|
|
. "git.golang1.ru/softonik/godog_and_gomega"
|
|
)
|
|
|
|
func InitializeScenario(ctx *godog.ScenarioContext) {
|
|
ctx.Step(`^Файл "([^"]*)":$`, файл)
|
|
ctx.Step(`^Добавлена функция "([^"]*)"$`, добавленаФункция)
|
|
ctx.Step(`^Добавлена функция "([^"]*)" с параметрами: "([^"]*)", "([^"]*)"$`, добавленаФункцияСПараметрами)
|
|
ctx.Step(`^Файл "([^"]*)" должен содержать:$`, файлДолженСодержать)
|
|
|
|
// -----------------------
|
|
ctx.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
|
|
beforeScenario()
|
|
return ctx, nil
|
|
})
|
|
ctx.After(func(ctx context.Context, sc *godog.Scenario, err error) (context.Context, error) {
|
|
afterScenario()
|
|
return ctx, nil
|
|
})
|
|
InitializeGomegaForGodog(ctx)
|
|
}
|
|
|
|
func InitializeSuite(tsc *godog.TestSuiteContext) {
|
|
tsc.BeforeSuite(beforeSuite)
|
|
tsc.AfterSuite(afterSuite)
|
|
}
|
|
|
|
func TestMain(m *testing.M) {
|
|
var opts = godog.Options{
|
|
Output: colors.Colored(os.Stdout),
|
|
Strict: true,
|
|
StopOnFailure: true,
|
|
}
|
|
r := godog.TestSuite{
|
|
Name: "app",
|
|
TestSuiteInitializer: InitializeSuite,
|
|
ScenarioInitializer: InitializeScenario,
|
|
Options: &opts,
|
|
}.Run()
|
|
os.Exit(r)
|
|
}
|