...

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

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

     1  package lexers_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	assert "github.com/alecthomas/assert/v2"
     7  
     8  	"github.com/alecthomas/chroma/v2"
     9  	"github.com/alecthomas/chroma/v2/lexers"
    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 := lexers.GlobalLexerRegistry.Get("C++").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