mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 14:55:38 -04: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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
names := make([]string, len(entries), len(entries))
|
names := make([]string, len(entries))
|
||||||
for i, entry := range entries {
|
for i, entry := range entries {
|
||||||
names[i] = entry.Name()
|
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