modules added
Этот коммит содержится в:
родитель
7ee82ead09
коммит
2afb31fd41
4 изменённых файлов: 14 добавлений и 7 удалений
3
go.mod
Обычный файл
3
go.mod
Обычный файл
|
@ -0,0 +1,3 @@
|
||||||
|
module github.com/andygeiss/esp32-transpiler
|
||||||
|
|
||||||
|
require github.com/andygeiss/assert v0.0.3
|
2
go.sum
Обычный файл
2
go.sum
Обычный файл
|
@ -0,0 +1,2 @@
|
||||||
|
github.com/andygeiss/assert v0.0.3 h1:PgY7eH+UaCvOzScsX3HGqNfCemkvpcNHQjwT2Dyq0sw=
|
||||||
|
github.com/andygeiss/assert v0.0.3/go.mod h1:ztUvWrfUo43X0zMA1XfX8esn5Uavk6ANSKTT0w2qvAI=
|
|
@ -2,7 +2,8 @@ package transpile_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
. "github.com/andygeiss/assert"
|
"github.com/andygeiss/assert"
|
||||||
|
"github.com/andygeiss/assert/is"
|
||||||
"github.com/andygeiss/esp32-transpiler/api/worker"
|
"github.com/andygeiss/esp32-transpiler/api/worker"
|
||||||
"github.com/andygeiss/esp32-transpiler/impl/transpile"
|
"github.com/andygeiss/esp32-transpiler/impl/transpile"
|
||||||
"io"
|
"io"
|
||||||
|
@ -30,5 +31,6 @@ func TestTranspileErrorShouldBeNil(t *testing.T) {
|
||||||
var in, out bytes.Buffer
|
var in, out bytes.Buffer
|
||||||
worker := &mockupWorker{&in, &out}
|
worker := &mockupWorker{&in, &out}
|
||||||
trans := transpile.NewTranspiler(worker)
|
trans := transpile.NewTranspiler(worker)
|
||||||
Assert(t, trans.Transpile(), IsNil())
|
err := trans.Transpile()
|
||||||
|
assert.That(t, err, is.Equal(nil))
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package worker_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
. "github.com/andygeiss/assert"
|
"github.com/andygeiss/assert"
|
||||||
|
"github.com/andygeiss/assert/is"
|
||||||
"github.com/andygeiss/esp32-transpiler/impl/worker"
|
"github.com/andygeiss/esp32-transpiler/impl/worker"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -23,10 +24,10 @@ func Validate(source, expected string, t *testing.T) {
|
||||||
var in, out bytes.Buffer
|
var in, out bytes.Buffer
|
||||||
in.WriteString(source)
|
in.WriteString(source)
|
||||||
wrk := worker.NewWorker(&in, &out, worker.NewMapping())
|
wrk := worker.NewWorker(&in, &out, worker.NewMapping())
|
||||||
Assert(t, wrk.Start(), IsNil())
|
assert.That(t, wrk.Start(), is.Equal(nil))
|
||||||
code := out.String()
|
code := out.String()
|
||||||
tcode, texpected := Trim(code), Trim(expected)
|
tcode, texpected := Trim(code), Trim(expected)
|
||||||
Assert(t, tcode, IsEqual(texpected))
|
assert.That(t, tcode, is.Equal(texpected))
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_Empty_Package(t *testing.T) {
|
func Test_Empty_Package(t *testing.T) {
|
||||||
|
@ -66,7 +67,6 @@ func Test_Const_String_Declaration(t *testing.T) {
|
||||||
Validate(source, expected, t)
|
Validate(source, expected, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func Test_Var_String_Declaration(t *testing.T) {
|
func Test_Var_String_Declaration(t *testing.T) {
|
||||||
source := `package test
|
source := `package test
|
||||||
var client wifi.Client
|
var client wifi.Client
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче