Skip to content

Commit

Permalink
gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jessp01 committed Jul 18, 2023
1 parent 0185247 commit 78b6c61
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
10 changes: 4 additions & 6 deletions helpers_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package highlight

import (
"bytes"
"io/ioutil"
"testing"

)

"bytes"
"io/ioutil"
"testing"
)

func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string) *Def {
var def *Def
Expand Down
38 changes: 19 additions & 19 deletions highlighter_test.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
package highlight

import (
"io/ioutil"
"testing"
"fmt"
"io/ioutil"
"path/filepath"
"strings"
"testing"
)

func TestInputs(t *testing.T){
func TestInputs(t *testing.T) {

test_inputs_dir := "./test_inputs/*"
files, err := filepath.Glob(test_inputs_dir)
if err != nil {
t.Errorf("Couldn't open '%s', error: %v\n", test_inputs_dir, err)
}
for _, filename := range(files){
ext := strings.Split(filename, ".")
data, _ := ioutil.ReadFile(filename)
fmt.Println("Testing def detection for " + filename)
def := getDefs(t, filename, data, "")
exp := ext[len(ext) -1]
if def.FileType != exp {
t.Errorf("\nInput [%#v]\nExpected[%#v]\nGot [%#v]\n",
//string(data), exp, def.FileType)
filename, exp, def.FileType)
test_inputs_dir := "./test_inputs/*"
files, err := filepath.Glob(test_inputs_dir)
if err != nil {
t.Errorf("Couldn't open '%s', error: %v\n", test_inputs_dir, err)
}
for _, filename := range files {
ext := strings.Split(filename, ".")
data, _ := ioutil.ReadFile(filename)
fmt.Println("Testing def detection for " + filename)
def := getDefs(t, filename, data, "")
exp := ext[len(ext)-1]
if def.FileType != exp {
t.Errorf("\nInput [%#v]\nExpected[%#v]\nGot [%#v]\n",
//string(data), exp, def.FileType)
filename, exp, def.FileType)
}
}
}
}

0 comments on commit 78b6c61

Please sign in to comment.