Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(715)

Side by Side Diff: src/pkg/go/doc/example.go

Issue 5358041: code review 5358041: renaming_2: gofix -r go1pkgrename src/pkg/[a-l]* (Closed)
Patch Set: diff -r f759d7ef4e8b https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/go/doc/comment.go ('k') | src/pkg/go/printer/printer.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Extract example functions from package ASTs. 5 // Extract example functions from package ASTs.
6 6
7 package doc 7 package doc
8 8
9 import ( 9 import (
10 "go/ast" 10 "go/ast"
11 "strings" 11 "strings"
12 "unicode" 12 "unicode"
13 » "utf8" 13 » "unicode/utf8"
14 ) 14 )
15 15
16 type Example struct { 16 type Example struct {
17 Name string // name of the item being demonstrated 17 Name string // name of the item being demonstrated
18 Body *ast.BlockStmt // code 18 Body *ast.BlockStmt // code
19 Output string // expected output 19 Output string // expected output
20 } 20 }
21 21
22 func Examples(pkg *ast.Package) []*Example { 22 func Examples(pkg *ast.Package) []*Example {
23 var examples []*Example 23 var examples []*Example
(...skipping 23 matching lines...) Expand all
47 func isTest(name, prefix string) bool { 47 func isTest(name, prefix string) bool {
48 if !strings.HasPrefix(name, prefix) { 48 if !strings.HasPrefix(name, prefix) {
49 return false 49 return false
50 } 50 }
51 if len(name) == len(prefix) { // "Test" is ok 51 if len(name) == len(prefix) { // "Test" is ok
52 return true 52 return true
53 } 53 }
54 rune, _ := utf8.DecodeRuneInString(name[len(prefix):]) 54 rune, _ := utf8.DecodeRuneInString(name[len(prefix):])
55 return !unicode.IsLower(rune) 55 return !unicode.IsLower(rune)
56 } 56 }
OLDNEW
« no previous file with comments | « src/pkg/go/doc/comment.go ('k') | src/pkg/go/printer/printer.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b