github.com/v2fly/tools@v0.100.0/godoc/spec_test.go (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package godoc
     6  
     7  import (
     8  	"bytes"
     9  	"strings"
    10  	"testing"
    11  )
    12  
    13  func TestParseEBNFString(t *testing.T) {
    14  	var p ebnfParser
    15  	var buf bytes.Buffer
    16  	src := []byte("octal_byte_value = `\\` octal_digit octal_digit octal_digit .")
    17  	p.parse(&buf, src)
    18  
    19  	if strings.Contains(buf.String(), "error") {
    20  		t.Error(buf.String())
    21  	}
    22  }