File: text_scanner_go110_test.go

package info (click to toggle)
golang-github-alecthomas-participle 0.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 564 kB
  • sloc: makefile: 2
file content (17 lines) | stat: -rw-r--r-- 426 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// +build !go1.11

package lexer

import (
	"testing"
	"text/scanner"

	"github.com/stretchr/testify/require"
)

func TestLexBacktickString(t *testing.T) {
	lexer := LexString("`hello\\nworld`")
	token := lexer.Next()
	// See https://github.com/golang/go/issues/23675.  Go 1.11 fixes token type into RawString.
	require.Equal(t, Token{Type: scanner.String, Value: "hello\\nworld", Pos: Position{Line: 1, Column: 1}}, token)
}