mirror of
https://github.com/golang/go.git
synced 2025-05-05 07:33:00 +00:00
Commit c8915a0696ddb53399e9c7ebae1cd1158f27175 changed the text/scanner package to return a scanner.RawString (rather than a scanner.String) token for raw string literals. This broke the EBNF parser which didn't look for scanner.RawString. Updated the EBNF parser code to reflect that change. Fixes golang/go#25986 Change-Id: Ib9c133a7c357dd750a4038d2ed39be86a245995c Reviewed-on: https://go-review.googlesource.com/120659 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
23 lines
475 B
Go
23 lines
475 B
Go
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package godoc
|
|
|
|
import (
|
|
"bytes"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestParseEBNFString(t *testing.T) {
|
|
var p ebnfParser
|
|
var buf bytes.Buffer
|
|
src := []byte("octal_byte_value = `\\` octal_digit octal_digit octal_digit .")
|
|
p.parse(&buf, src)
|
|
|
|
if strings.Contains(buf.String(), "error") {
|
|
t.Error(buf.String())
|
|
}
|
|
}
|