Skip to content

Commit 645e161

Browse files
committed
update CI stuffz
1 parent c19a2bb commit 645e161

10 files changed

Lines changed: 249 additions & 16 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/

.goreleaser.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ builds:
66
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.buildDate={{.Date}}
77

88
archives:
9-
- replacements:
10-
darwin: Darwin
11-
linux: Linux
12-
windows: Windows
13-
386: i386
14-
amd64: x86_64
9+
-
10+
replacements:
11+
darwin: Darwin
12+
linux: Linux
13+
windows: Windows
14+
386: i386
15+
amd64: x86_64
16+
format: binary
1517

1618
checksum:
1719
name_template: 'checksums.txt'

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ release: gox
2323
@gox -osarch="darwin/386 darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" ${LDFLAGS} -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"
2424

2525
#Build a development build
26-
dev:
26+
build:
2727
@go build ${LDFLAGS_DEV} -o bin/${BINARY}
2828

2929
#Install a release build on your local system
@@ -32,3 +32,10 @@ install: clean
3232

3333
clean:
3434
@go clean -i
35+
36+
test:
37+
@go test -v -race ./...
38+
39+
# update the golden files used for the integration tests
40+
update-tests:
41+
@go test integration/cli_test.go -update

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# fixme
2-
2+
[![CircleCI](https://circleci.com/gh/jakewarren/fixme.svg?style=shield)](https://circleci.com/gh/jakewarren/fixme)
33
[![GitHub release](http://img.shields.io/github/release/jakewarren/fixme.svg?style=flat-square)](https://github.com/jakewarren/fixme/releases)
44
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/jakewarren/fixme/blob/master/LICENSE)
55
[![Go Report Card](https://goreportcard.com/badge/github.com/jakewarren/fixme)](https://goreportcard.com/report/github.com/jakewarren/fixme)

config.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: 2
2+
jobs:
3+
lint:
4+
docker:
5+
- image: golangci/golangci-lint:v1.19.1
6+
steps:
7+
- checkout
8+
- run:
9+
name: "Run golangci-lint"
10+
command: golangci-lint run --color always --enable-all --exclude-use-default -D godox -D gochecknoglobals -D gochecknoinits -D lll
11+
critic:
12+
docker:
13+
- image: jakewarren/gocritic:latest
14+
steps:
15+
- checkout
16+
- run:
17+
name: "Run gocritic"
18+
command: gocritic check -enableAll -coloredOutput || true
19+
test:
20+
docker:
21+
- image: circleci/golang:1.13
22+
steps:
23+
- checkout
24+
- run:
25+
name: "Run tests"
26+
command: |
27+
make test
28+
29+
release:
30+
docker:
31+
- image: circleci/golang:1.13
32+
steps:
33+
- checkout
34+
- run: curl -sL https://git.io/goreleaser | bash
35+
36+
workflows:
37+
version: 2
38+
build:
39+
jobs:
40+
- lint
41+
- test
42+
- critic
43+
- release:
44+
# Only run this job on git tag pushes
45+
filters:
46+
branches:
47+
ignore: /.*/
48+
tags:
49+
only: /v[0-9]+(\.[0-9]+)*(-.*)*/

go.mod

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@ require (
88
github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 // indirect
99
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
1010
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
11-
github.com/apex/log v1.0.0
11+
github.com/apex/log v1.1.1
1212
github.com/cloudflare/ahocorasick v0.0.0-20131126104932-1ce46e42b741
13-
github.com/fatih/color v1.5.0
14-
github.com/mattn/go-colorable v0.0.9 // indirect
15-
github.com/mattn/go-isatty v0.0.3 // indirect
16-
github.com/pkg/errors v0.8.0 // indirect
13+
github.com/fatih/color v1.7.0
1714
github.com/remeh/sizedwaitgroup v0.0.0-20161123101944-4b44541c9359
18-
github.com/sergi/go-diff v1.0.0 // indirect
1915
github.com/stretchr/testify v1.4.0 // indirect
20-
golang.org/x/sys v0.0.0-20170927054621-314a259e304f // indirect
21-
gopkg.in/alecthomas/kingpin.v2 v2.2.5
16+
gopkg.in/alecthomas/kingpin.v2 v2.2.6
2217
)

go.sum

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,80 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZq
1010
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
1111
github.com/apex/log v1.0.0 h1:5UWeZC54mWVtOGSCjtuvDPgY/o0QxmjQgvYZ27pLVGQ=
1212
github.com/apex/log v1.0.0/go.mod h1:yA770aXIDQrhVOIGurT/pVdfCpSq1GQV/auzMN5fzvY=
13+
github.com/apex/log v1.1.1 h1:BwhRZ0qbjYtTob0I+2M+smavV0kOC8XgcnGZcyL9liA=
14+
github.com/apex/log v1.1.1/go.mod h1:Ls949n1HFtXfbDcjiTTFQqkVUrte0puoIBfO3SVgwOA=
15+
github.com/aphistic/golf v0.0.0-20180712155816-02c07f170c5a/go.mod h1:3NqKYiepwy8kCu4PNA+aP7WUV72eXWJeP9/r3/K9aLE=
16+
github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys=
17+
github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
18+
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
1319
github.com/cloudflare/ahocorasick v0.0.0-20131126104932-1ce46e42b741 h1:8Xzh8Z+jiT/MpNO1RRu4/o4o3hP3iGWJaD5GfaH2Kak=
1420
github.com/cloudflare/ahocorasick v0.0.0-20131126104932-1ce46e42b741/go.mod h1:tGWUZLZp9ajsxUOnHmFFLnqnlKXsCn6GReG4jAD59H0=
1521
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
1622
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1723
github.com/fatih/color v1.5.0 h1:vBh+kQp8lg9XPr56u1CPrWjFXtdphMoGWVHr9/1c+A0=
1824
github.com/fatih/color v1.5.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
25+
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
26+
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
27+
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
28+
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
29+
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
30+
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
31+
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
32+
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0=
33+
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
1934
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
35+
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
36+
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
37+
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
2038
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
2139
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
40+
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
41+
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
42+
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
43+
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
44+
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
45+
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
2246
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
47+
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
48+
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
2349
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2450
github.com/remeh/sizedwaitgroup v0.0.0-20161123101944-4b44541c9359 h1:Qevki/5jkGrihNHC/G/x515V0DzNqIreUS2QKTcu5lM=
2551
github.com/remeh/sizedwaitgroup v0.0.0-20161123101944-4b44541c9359/go.mod h1:3j2R4OIe/SeS6YDhICBy22RWjJC5eNCJ1V+9+NVNYlo=
52+
github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
2653
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
54+
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
55+
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
56+
github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs=
2757
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
58+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
2859
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
2960
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
61+
github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0=
62+
github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0=
63+
github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao=
64+
github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4=
65+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
66+
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
67+
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
68+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
69+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
70+
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3071
golang.org/x/sys v0.0.0-20170927054621-314a259e304f h1:iUy6hSM2lPBGm2d9HgXq1GqYPwcJvA8ihnWauXggYMs=
3172
golang.org/x/sys v0.0.0-20170927054621-314a259e304f/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
73+
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
74+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
75+
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
76+
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
77+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
78+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
3279
gopkg.in/alecthomas/kingpin.v2 v2.2.5 h1:qskSCq465uEvC3oGocwvZNsO3RF3SpLVLumOAhL0bXo=
3380
gopkg.in/alecthomas/kingpin.v2 v2.2.5/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
81+
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
82+
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
3483
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
3584
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
85+
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
86+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
87+
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
3688
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
3789
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

integration/cli_test.go

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package integration
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"io/ioutil"
7+
"os"
8+
"os/exec"
9+
"path"
10+
"path/filepath"
11+
"reflect"
12+
"regexp"
13+
"runtime"
14+
"testing"
15+
)
16+
17+
var update = flag.Bool("update", false, "update golden files")
18+
19+
var binaryName = "fixme"
20+
21+
func fixturePath(t *testing.T, fixture string) string {
22+
_, filename, _, ok := runtime.Caller(0)
23+
if !ok {
24+
t.Fatalf("problems recovering caller information")
25+
}
26+
27+
return filepath.Join(filepath.Dir(filename), fixture)
28+
}
29+
30+
func writeFixture(t *testing.T, fixture string, content []byte) {
31+
err := ioutil.WriteFile(fixturePath(t, fixture), content, 0644)
32+
if err != nil {
33+
t.Fatal(err)
34+
}
35+
}
36+
37+
func loadFixture(t *testing.T, fixture string) string {
38+
content, err := ioutil.ReadFile(fixturePath(t, fixture))
39+
if err != nil {
40+
t.Fatal(err)
41+
}
42+
43+
return cleanPath(string(content))
44+
}
45+
46+
// since the CI will likely have a different working path we need to massage the output a bit to remove the absolute path
47+
func cleanPath(input string) string {
48+
pathRE := regexp.MustCompile(`(?m)^.+testdata/test\.txt`)
49+
substitution := "testdata/test.txt"
50+
51+
return pathRE.ReplaceAllString(input, substitution)
52+
}
53+
54+
func TestCliArgs(t *testing.T) {
55+
tests := []struct {
56+
name string
57+
args []string
58+
fixture string
59+
}{
60+
{"test.txt", []string{"./testdata/test.txt"}, "test-txt.golden"},
61+
}
62+
63+
for _, tt := range tests {
64+
t.Run(tt.name, func(t *testing.T) {
65+
dir, err := os.Getwd()
66+
if err != nil {
67+
t.Fatal(err)
68+
}
69+
70+
cmd := exec.Command(path.Join(dir, "bin", binaryName), tt.args...)
71+
output, err := cmd.CombinedOutput()
72+
if err != nil {
73+
fmt.Printf("debug: dir: %s\n", dir)
74+
fmt.Printf("debug: cmd: %s\n", path.Join(dir, "bin", binaryName))
75+
fmt.Printf("debug: args: %v\n", tt.args)
76+
fmt.Printf("debug: output: %s\n", output)
77+
fmt.Printf("debug: error: %s\n", err)
78+
t.Fatal(err)
79+
}
80+
81+
if *update {
82+
writeFixture(t, tt.fixture, output)
83+
}
84+
85+
actual := cleanPath(string(output))
86+
87+
expected := loadFixture(t, tt.fixture)
88+
89+
if !reflect.DeepEqual(actual, expected) {
90+
t.Fatalf("actual = %s, expected = %s", actual, expected)
91+
}
92+
})
93+
}
94+
}
95+
96+
func TestMain(m *testing.M) {
97+
err := os.Chdir("..")
98+
if err != nil {
99+
fmt.Printf("could not change dir: %v", err)
100+
os.Exit(1)
101+
}
102+
makeCmd := exec.Command("make", "build")
103+
err = makeCmd.Run()
104+
if err != nil {
105+
fmt.Printf("could not make binary for %s: %v", binaryName, err)
106+
os.Exit(1)
107+
}
108+
109+
os.Exit(m.Run())
110+
}

integration/test-txt.golden

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
• /home/jake/golang/src/github.com/jakewarren/fixme/testdata/test.txt [7 messages]:
2+
[Line 1] ✐ NOTE: test note
3+
[Line 2] ↻ OPTIMIZE: test optimize
4+
[Line 3] ✓ TODO: test todo
5+
[Line 4] ✄ HACK: test hack
6+
[Line 5] ✗ XXX: test XXX
7+
[Line 6] ☠ FIXME: test fixme
8+
[Line 7] ☢ BUG: test bug
9+
10+

testdata/test.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//NOTE: test note
2+
#OPTIMIZE: test optimize
3+
//TODO: test todo
4+
//HACK: test hack
5+
//XXX: test XXX
6+
//FIXME: test fixme
7+
//BUG: test bug

0 commit comments

Comments
 (0)