mirror of
https://github.com/walles/moar.git
synced 2024-11-20 12:28:20 +03:00
Make the tests pass
This commit is contained in:
parent
4357eda016
commit
917f75d591
@ -194,8 +194,8 @@ func TestCodeHighlighting(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCodeHighlight_compressed(t *testing.T) {
|
||||
// Same as TestCodeHighlighting but with "markdown.md.gz"
|
||||
reader, err := NewReaderFromFilename("../sample-files/markdown.md.gz", *styles.Get("native"), formatters.TTY16m, nil)
|
||||
// Same as TestCodeHighlighting but with "compressed-markdown.md.gz"
|
||||
reader, err := NewReaderFromFilename("../sample-files/compressed-markdown.md.gz", *styles.Get("native"), formatters.TTY16m, nil)
|
||||
assert.NilError(t, err)
|
||||
assert.NilError(t, reader._wait())
|
||||
|
||||
|
@ -399,6 +399,10 @@ func NewReaderFromFilenameWithoutStyle(filename string, formatter chroma.Formatt
|
||||
returnMe.name = &filename
|
||||
returnMe.Unlock()
|
||||
|
||||
if lexer == nil {
|
||||
returnMe.highlightingDone.Store(true)
|
||||
}
|
||||
|
||||
return returnMe, nil
|
||||
}
|
||||
|
||||
|
@ -144,22 +144,6 @@ func (r *Reader) _wait() error {
|
||||
|
||||
func TestGetLines(t *testing.T) {
|
||||
for _, file := range getTestFiles(t) {
|
||||
if strings.HasSuffix(file, ".xz") {
|
||||
_, err := exec.LookPath("xz")
|
||||
if err != nil {
|
||||
t.Log("Not testing xz compressed file, xz not found in $PATH: ", file)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if strings.HasSuffix(file, ".bz2") {
|
||||
_, err := exec.LookPath("bzip2")
|
||||
if err != nil {
|
||||
t.Log("Not testing bzip2 compressed file, bzip2 not found in $PATH: ", file)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
reader, err := NewReaderFromFilename(file, *styles.Get("native"), formatters.TTY16m, nil)
|
||||
if err != nil {
|
||||
t.Errorf("Error opening file <%s>: %s", file, err.Error())
|
||||
|
Loading…
Reference in New Issue
Block a user