1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-07-01 00:35:06 +02:00

Emit error tokens when there's a group mismatch.

Also don't panic/recover, as we no longer use panic to report "real"
errors.

Fixes #295.
This commit is contained in:
Alec Thomas
2019-10-24 17:02:24 +11:00
parent a1c4eaa235
commit bbc59ac372
9 changed files with 12 additions and 29 deletions

View File

@ -2,7 +2,6 @@ package html
import (
"bytes"
"errors"
"io/ioutil"
"strings"
"testing"
@ -50,14 +49,6 @@ func TestSplitTokensIntoLines(t *testing.T) {
assert.Equal(t, expected, actual)
}
func TestIteratorPanicRecovery(t *testing.T) {
it := func() chroma.Token {
panic(errors.New("bad"))
}
err := New().Format(ioutil.Discard, styles.Fallback, it)
assert.Error(t, err)
}
func TestFormatterStyleToCSS(t *testing.T) {
builder := styles.Get("github").Builder()
builder.Add(chroma.LineHighlight, "bg:#ffffcc")