Skip to content

Commit

Permalink
sublime packages tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zoli committed Mar 17, 2016
1 parent 7cd20ad commit e765494
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions lib/packages/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type simple struct {
marshal json.Unmarshaler
}

// TODO: better errors, maybe we should introduce error type and let
// the loader decide how to log
func (s *simple) Load() {
log.Debug("Loading %s", s.Name())
data, err := ioutil.ReadFile(s.filename)
Expand Down
21 changes: 14 additions & 7 deletions lib/sublime/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,30 @@ import (
"path"
"testing"

"github.com/limetext/lime-backend/lib"
_ "github.com/limetext/lime-backend/lib/commands"
"github.com/limetext/lime-backend/lib/packages"
)

func TestLoadPlugin(t *testing.T) {
pn := path.Join("testdata", "packages", "plugin.py")
pkg := newPKG(path.Join("testdata", "packages")).(*pkg)
pkg.loadPlugin(pn)

if _, exist := pkg.plugins[pn]; !exist {
t.Errorf("Expected to %s exist in %s package plugins", pn, pkg.Name())
}
}

func TestLoadPlugins(t *testing.T) {
pn := path.Join("testdata", "packages", "plugin.py")
pkg := newPKG(path.Join("testdata", "packages")).(*pkg)
pkg.loadPlugins()

if _, exist := pkg.plugins[pn]; !exist {
t.Errorf("Expected to %s exist in %s package plugins", pn, pkg.Name())
}
}

func TestLoadKeyBindings(t *testing.T) {

}

func TestLoadSettings(t *testing.T) {

func init() {
packages.Unregister(packageRecord)
}
4 changes: 1 addition & 3 deletions lib/sublime/sublime_api_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ func sublime_PackagesPath(tu *py.Tuple) (py.Object, error) {
var (
arg1 string
)
if tu.Not() {
arg1 = "default"
} else if v, err := tu.GetItem(0); err != nil {
if v, err := tu.GetItem(0); err != nil {
return nil, err
} else {
if v3, err2 := fromPython(v); err2 != nil {
Expand Down
Empty file.

0 comments on commit e765494

Please sign in to comment.