Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
41 changes: 41 additions & 0 deletions context_nowin_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
33 changes: 0 additions & 33 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions error_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// +build !windows
package libsass

import (
Expand Down
3 changes: 2 additions & 1 deletion libs/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions libsass-build/sass_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down