diff --git a/appveyor.yml b/appveyor.yml index f81774d..a2e834b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,8 +53,9 @@ install: - set CXX=g++ - echo %PATH% - echo %GOPATH% - - dir C:\mingw64\bin + - # dir C:\mingw64\bin - go get golang.org/x/net/context + - go test -x -v -ldflags "-extldflags '-static'" build_script: - go build -x -ldflags "-extldflags '-static'" diff --git a/circle.yml b/circle.yml index c582bdd..463d22e 100644 --- a/circle.yml +++ b/circle.yml @@ -25,4 +25,4 @@ dependencies: - go test -i -race $(go list -f '{{if len .TestGoFiles}}{{.ImportPath}}{{end}}' ./... | grep -v /vendor/) test: override: - - go test -race $(go list -f '{{if len .TestGoFiles}}{{.ImportPath}}{{end}}' ./... | grep -v /vendor/) + - go test -v -short -race $(go list -f '{{if len .TestGoFiles}}{{.ImportPath}}{{end}}' ./... | grep -v /vendor/) diff --git a/context_nowin_test.go b/context_nowin_test.go new file mode 100644 index 0000000..2bcd981 --- /dev/null +++ b/context_nowin_test.go @@ -0,0 +1,41 @@ +// +build !windows +package libsass + +import ( + "bytes" + "testing" +) + +func TestLibsassError(t *testing.T) { + + in := bytes.NewBufferString(`div { + color: red(blue, purple); +}`) + + var out bytes.Buffer + ctx := NewContext() + + ctx.Funcs.Add(Func{ + Sign: "foo()", + Fn: TestCallback, + Ctx: &ctx, + }) + err := ctx.Compile(in, &out) + + if err == nil { + t.Error("No error thrown for incorrect arity") + } + + if e := "wrong number of arguments (2 for 1) for `red'"; e != ctx.err.Message { + t.Errorf("wanted:%s\ngot:%s\n", e, ctx.err.Message) + } + e := `Error > stdin:2 +wrong number of arguments (2 for 1) for ` + "`" + `red' +div { + color: red(blue, purple); +} +` + if e != err.Error() { + t.Errorf("wanted:\n%s\ngot:\n%s\n", e, err) + } +} diff --git a/context_test.go b/context_test.go index c1dd398..b93b57f 100644 --- a/context_test.go +++ b/context_test.go @@ -98,39 +98,6 @@ div { } -func TestLibsassError(t *testing.T) { - in := bytes.NewBufferString(`div { - color: red(blue, purple); -}`) - - var out bytes.Buffer - ctx := NewContext() - - ctx.Funcs.Add(Func{ - Sign: "foo()", - Fn: TestCallback, - Ctx: &ctx, - }) - err := ctx.Compile(in, &out) - - if err == nil { - t.Error("No error thrown for incorrect arity") - } - - if e := "wrong number of arguments (2 for 1) for `red'"; e != ctx.err.Message { - t.Errorf("wanted:%s\ngot:%s\n", e, ctx.err.Message) - } - e := `Error > stdin:2 -wrong number of arguments (2 for 1) for ` + "`" + `red' -div { - color: red(blue, purple); -} -` - if e != err.Error() { - t.Errorf("wanted:\n%s\ngot:\n%s\n", e, err) - } -} - func ExampleContext_Compile() { in := bytes.NewBufferString(`div { color: red(blue); diff --git a/error_test.go b/error_test.go index 5c96eee..69c4892 100644 --- a/error_test.go +++ b/error_test.go @@ -1,3 +1,4 @@ +// +build !windows package libsass import ( diff --git a/libs/wrap.go b/libs/wrap.go index fd82d16..327529f 100644 --- a/libs/wrap.go +++ b/libs/wrap.go @@ -242,8 +242,9 @@ func SassContextGetOutputString(goctx SassContext) string { // SassContextGetErrorJSON requests an error in JSON format from libsass func SassContextGetErrorJSON(goctx SassContext) string { - cstr := C.sass_context_get_error_json(goctx) + cstr := C.sass_context_take_error_json(goctx) defer C.free(unsafe.Pointer(cstr)) + fmt.Println("Error text yo!", C.GoString(cstr)) return C.GoString(cstr) } diff --git a/libsass-build/sass_context.cpp b/libsass-build/sass_context.cpp index 32e6b83..ced22ef 100644 --- a/libsass-build/sass_context.cpp +++ b/libsass-build/sass_context.cpp @@ -444,8 +444,8 @@ extern "C" { if (compiler->state != SASS_COMPILER_CREATED) return -1; if (compiler->c_ctx == NULL) return 1; if (compiler->cpp_ctx == NULL) return 1; - if (compiler->c_ctx->error_status) - return compiler->c_ctx->error_status; + // if (compiler->c_ctx->error_status) + // return compiler->c_ctx->error_status; // parse the context we have set up (file or data) compiler->root = sass_parse_block(compiler); // success