2019-10-05 22:53:51 +10:00
|
|
|
package c_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-06-18 16:55:49 +10:00
|
|
|
"github.com/stretchr/testify/assert"
|
2019-10-05 22:53:51 +10:00
|
|
|
|
|
|
|
"github.com/alecthomas/chroma"
|
|
|
|
"github.com/alecthomas/chroma/lexers/c"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestIssue290(t *testing.T) {
|
|
|
|
input := `// 64-bit floats have 53 digits of precision, including the whole-number-part.
|
|
|
|
double a = 0011111110111001100110011001100110011001100110011001100110011010; // imperfect representation of 0.1
|
|
|
|
double b = 0011111111001001100110011001100110011001100110011001100110011010; // imperfect representation of 0.2
|
|
|
|
double c = 0011111111010011001100110011001100110011001100110011001100110011; // imperfect representation of 0.3
|
|
|
|
double a + b = 0011111111010011001100110011001100110011001100110011001100110100; // Note that this is not quite equal to the "canonical" 0.3!a
|
|
|
|
`
|
|
|
|
it, err := c.CPP.Tokenise(nil, input)
|
2019-11-05 13:54:35 +11:00
|
|
|
assert.NoError(t, err)
|
2019-10-05 22:53:51 +10:00
|
|
|
for {
|
|
|
|
token := it()
|
|
|
|
if token == chroma.EOF {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|