mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-09-05 16:37:20 -04:00
gofmt
This commit is contained in:
+4
-6
@@ -1,12 +1,10 @@
|
|||||||
package highlight
|
package highlight
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string) *Def {
|
func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string) *Def {
|
||||||
var def *Def
|
var def *Def
|
||||||
|
|||||||
+19
-19
@@ -1,30 +1,30 @@
|
|||||||
package highlight
|
package highlight
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"testing"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInputs(t *testing.T){
|
func TestInputs(t *testing.T) {
|
||||||
|
|
||||||
test_inputs_dir := "./test_inputs/*"
|
test_inputs_dir := "./test_inputs/*"
|
||||||
files, err := filepath.Glob(test_inputs_dir)
|
files, err := filepath.Glob(test_inputs_dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Couldn't open '%s', error: %v\n", test_inputs_dir, err)
|
t.Errorf("Couldn't open '%s', error: %v\n", test_inputs_dir, err)
|
||||||
}
|
}
|
||||||
for _, filename := range(files){
|
for _, filename := range files {
|
||||||
ext := strings.Split(filename, ".")
|
ext := strings.Split(filename, ".")
|
||||||
data, _ := ioutil.ReadFile(filename)
|
data, _ := ioutil.ReadFile(filename)
|
||||||
fmt.Println("Testing def detection for " + filename)
|
fmt.Println("Testing def detection for " + filename)
|
||||||
def := getDefs(t, filename, data, "")
|
def := getDefs(t, filename, data, "")
|
||||||
exp := ext[len(ext) -1]
|
exp := ext[len(ext)-1]
|
||||||
if def.FileType != exp {
|
if def.FileType != exp {
|
||||||
t.Errorf("\nInput [%#v]\nExpected[%#v]\nGot [%#v]\n",
|
t.Errorf("\nInput [%#v]\nExpected[%#v]\nGot [%#v]\n",
|
||||||
//string(data), exp, def.FileType)
|
//string(data), exp, def.FileType)
|
||||||
filename, exp, def.FileType)
|
filename, exp, def.FileType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user