Этот коммит содержится в:
andygeiss 2018-12-19 19:28:33 +01:00
родитель 7ee82ead09
коммит 2afb31fd41
4 изменённых файлов: 14 добавлений и 7 удалений

3
go.mod Обычный файл
Просмотреть файл

@ -0,0 +1,3 @@
module github.com/andygeiss/esp32-transpiler
require github.com/andygeiss/assert v0.0.3

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 (
"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/impl/transpile"
"io"
@ -30,5 +31,6 @@ func TestTranspileErrorShouldBeNil(t *testing.T) {
var in, out bytes.Buffer
worker := &mockupWorker{&in, &out}
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 (
"bytes"
. "github.com/andygeiss/assert"
"github.com/andygeiss/assert"
"github.com/andygeiss/assert/is"
"github.com/andygeiss/esp32-transpiler/impl/worker"
"strings"
"testing"
@ -23,10 +24,10 @@ func Validate(source, expected string, t *testing.T) {
var in, out bytes.Buffer
in.WriteString(source)
wrk := worker.NewWorker(&in, &out, worker.NewMapping())
Assert(t, wrk.Start(), IsNil())
assert.That(t, wrk.Start(), is.Equal(nil))
code := out.String()
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) {
@ -66,7 +67,6 @@ func Test_Const_String_Declaration(t *testing.T) {
Validate(source, expected, t)
}
func Test_Var_String_Declaration(t *testing.T) {
source := `package test
var client wifi.Client
@ -476,4 +476,4 @@ func Test_WiFiWebClient(t *testing.T) {
}
}`
Validate(source, expected, t)
}
}