...

Source file src/github.com/alecthomas/chroma/lexers/c/cpp_test.go

Documentation: github.com/alecthomas/chroma/lexers/c

     1  package c_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  
     8  	"github.com/alecthomas/chroma"
     9  	"github.com/alecthomas/chroma/lexers/c"
    10  )
    11  
    12  func TestIssue290(t *testing.T) {
    13  	input := `// 64-bit floats have 53 digits of precision, including the whole-number-part.
    14  double a =     0011111110111001100110011001100110011001100110011001100110011010; // imperfect representation of 0.1
    15  double b =     0011111111001001100110011001100110011001100110011001100110011010; // imperfect representation of 0.2
    16  double c =     0011111111010011001100110011001100110011001100110011001100110011; // imperfect representation of 0.3
    17  double a + b = 0011111111010011001100110011001100110011001100110011001100110100; // Note that this is not quite equal to the "canonical" 0.3!a
    18  `
    19  	it, err := c.CPP.Tokenise(nil, input)
    20  	assert.NoError(t, err)
    21  	for {
    22  		token := it()
    23  		if token == chroma.EOF {
    24  			break
    25  		}
    26  	}
    27  }
    28  

View as plain text