mirror of
https://github.com/zyedidia/micro.git
synced 2024-10-05 16:07:54 +03:00
refactor(runtime): simplify AssetDir() (#2761)
* refactor(runtime): simplify AssetDir() * test(runtime): remove cwd checks
This commit is contained in:
parent
127b340a08
commit
b16af564a7
@ -22,7 +22,7 @@ func AssetDir(name string) ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
names := make([]string, len(entries), len(entries))
|
||||
names := make([]string, len(entries))
|
||||
for i, entry := range entries {
|
||||
names[i] = entry.Name()
|
||||
}
|
||||
|
16
runtime/runtime_test.go
Normal file
16
runtime/runtime_test.go
Normal file
@ -0,0 +1,16 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAssetDir(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Test AssetDir
|
||||
entries, err := AssetDir("syntax")
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, entries, "go.yaml")
|
||||
assert.True(t, len(entries) > 5)
|
||||
}
|
Loading…
Reference in New Issue
Block a user