Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Add XML comment style #80

Closed
wants to merge 4 commits into from
Closed

Add XML comment style #80

wants to merge 4 commits into from

Conversation

adrienjoly
Copy link
Contributor

@adrienjoly adrienjoly commented Apr 28, 2020

Contributes to #22.

Adds xml format to add comments surrounded by <!-- and -->

Also fixes a bug with template rendering which was using HTML templating, causing escaping of < into &lt;.

note: if we put the right tags, tests fail
@adrienjoly adrienjoly changed the title add XML comment style Add XML comment style Apr 28, 2020
@adrienjoly
Copy link
Contributor Author

When replacing aaXMLaa by <!-- and bbXMLbb by -->, getting the following test failures:

make test           GO111MODULE=on go test -v ./...
?       github.com/fbiville/headache/cmd/headache       [no test files]
=== RUN   TestCore
Running Suite: Core Suite
=========================
Random Seed: 1588098406
Will run 88 of 88 specs

••••••••••••••••••PASS: Read(string)
PASS:   Open(string,int,os.FileMode)

------------------------------
•! Panic [0.001 seconds]
Headache
/Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:30
  updates the header according to the comment style [It]
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:80

  Test Panicked
  
  
  mock: Unexpected Method Call
  -----------------------------
  
  Write([]uint8)
                0: []byte{0x2f, 0x2a, 0xa, 0x2a, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0xa, 0x2a, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x65, 0x78, 0x74, 0xa, 0x2a, 0x2f, 0xa, 0xa, 0x2f, 0x2f, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0xa, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x65, 0x78, 0x74, 0xa, 0xa, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x77, 0x6f, 0x72, 0x6c, 0x64}
  
  The closest call I have is: 
  
  Write([]uint8)
                0: []byte{0x2f, 0x2a, 0xa, 0x2a, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0xa, 0x2a, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x65, 0x78, 0x74, 0xa, 0x2a, 0x2f, 0xa, 0xa, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x77, 0x6f, 0x72, 0x6c, 0x64}
  
  Difference found in argument 0:
  
  --- Expected
  +++ Actual
  @@ -1,2 +1,2 @@
  -([]uint8) (len=60) {
  +([]uint8) (len=106) {
    00000000  2f 2a 0a 2a 20 73 6f 6d  65 20 6d 75 6c 74 69 2d  |/*.* some multi-|
  @@ -4,3 +4,6 @@
    00000020  74 68 20 73 6f 6d 65 20  74 65 78 74 0a 2a 2f 0a  |th some text.*/.|
  - 00000030  0a 68 65 6c 6c 6f 0a 77  6f 72 6c 64              |.hello.world|
  + 00000030  0a 2f 2f 20 73 6f 6d 65  20 6d 75 6c 74 69 2d 6c  |.// some multi-l|
  + 00000040  69 6e 65 20 68 65 61 64  65 72 20 0a 2f 2f 20 77  |ine header .// w|
  + 00000050  69 74 68 20 73 6f 6d 65  20 74 65 78 74 0a 0a 68  |ith some text..h|
  + 00000060  65 6c 6c 6f 0a 77 6f 72  6c 64                    |ello.world|
   }
  
  Diff: 0: FAIL:  ([]uint8=[47 42 10 42 32 115 111 109 101 32 109 117 108 116 105 45 108 105 110 101 32 104 101 97 100 101 114 10 42 32 119 105 116 104 32 115 111 109 101 32 116 101 120 116 10 42 47 10 10 47 47 32 115 111 109 101 32 109 117 108 116 105 45 108 105 110 101 32 104 101 97 100 101 114 32 10 47 47 32 119 105 116 104 32 115 111 109 101 32 116 101 120 116 10 10 104 101 108 108 111 10 119 111 114 108 100]) != ([]uint8=[47 42 10 42 32 115 111 109 101 32 109 117 108 116 105 45 108 105 110 101 32 104 101 97 100 101 114 10 42 32 119 105 116 104 32 115 111 109 101 32 116 101 120 116 10 42 47 10 10 104 101 108 108 111 10 119 111 114 108 100])
  /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236

  Full Stack Trace
  github.com/stretchr/testify/mock.(*Mock).fail(0xc000149ae0, 0x158e08d, 0x6f, 0xc0002ba840, 0x4, 0x4)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236 +0x17c
  github.com/stretchr/testify/mock.(*Mock).MethodCalled(0xc000149ae0, 0x192b0fb, 0x5, 0xc0002ae990, 0x1, 0x1, 0xc0002ba800, 0x4, 0x4)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:366 +0x662
  github.com/stretchr/testify/mock.(*Mock).Called(0xc000149ae0, 0xc0002ae990, 0x1, 0x1, 0xc000149ae0, 0xc00000fbc0, 0xc00029d078)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:338 +0x1a7
  github.com/fbiville/headache/internal/pkg/fs_mocks.(*File).Write(0xc000149ae0, 0xc000141200, 0x6a, 0x80, 0xc040000000, 0x6315440)
        /Users/adrienjoly/Downloads/headache/internal/pkg/fs_mocks/File.go:28 +0xb2
  github.com/fbiville/headache/internal/pkg/core.(*Headache).writeToFile(0xc0001227c8, 0x1571ce6, 0xb, 0xc000141200, 0x6a, 0x80)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:117 +0x100
  github.com/fbiville/headache/internal/pkg/core.(*Headache).UpdateFile(0xc0001227c8, 0x1571ce6, 0xb, 0x0, 0x0, 0xc0002954a0, 0x158591a, 0x2f)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:63 +0x3d3
  github.com/fbiville/headache/internal/pkg/core.(*Headache).Run(0xc0001227c8, 0xc0000b1300)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:39 +0xc8
  github.com/fbiville/headache/internal/pkg/core_test.glob..func5.4()
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:106 +0x719
  github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync(0xc00045c480, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/runner.go:113 +0xa3
  github.com/onsi/ginkgo/internal/leafnodes.(*runner).run(0xc00045c480, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/runner.go:64 +0xcf
  github.com/onsi/ginkgo/internal/leafnodes.(*ItNode).Run(0xc00039fde0, 0x16271a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/it_node.go:26 +0x64
  github.com/onsi/ginkgo/internal/spec.(*Spec).runSample(0xc0004fb0e0, 0x0, 0x16271a0, 0xc000130c40)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/spec/spec.go:215 +0x638
  github.com/onsi/ginkgo/internal/spec.(*Spec).Run(0xc0004fb0e0, 0x16271a0, 0xc000130c40)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/spec/spec.go:138 +0xf2
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runSpec(0xc000162000, 0xc0004fb0e0, 0x0)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:200 +0x10f
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runSpecs(0xc000162000, 0x1)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:170 +0x120
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run(0xc000162000, 0xc000126088)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:66 +0x117
  github.com/onsi/ginkgo/internal/suite.(*Suite).Run(0xc000148370, 0x6365880, 0xc000154b40, 0x1570a66, 0xa, 0xc0004697e0, 0x1, 0x1, 0x16322a0, 0xc000130c40, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/suite/suite.go:62 +0x42b
  github.com/onsi/ginkgo.RunSpecsWithCustomReporters(0x16277c0, 0xc000154b40, 0x1570a66, 0xa, 0xc00003a728, 0x1, 0x1, 0x100ea68)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/ginkgo_dsl.go:226 +0x217
  github.com/onsi/ginkgo.RunSpecs(0x16277c0, 0xc000154b40, 0x1570a66, 0xa, 0x13d46474271f8)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/ginkgo_dsl.go:207 +0x16e
  github.com/fbiville/headache/internal/pkg/core_test.TestCore(0xc000154b40)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/core_suite_test.go:28 +0x96
  testing.tRunner(0xc000154b40, 0x1597bf0)
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0xdc
  created by testing.(*T).Run
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1043 +0x357
------------------------------
PASS:   Read(string)
PASS:   Open(string,int,os.FileMode)
•! Panic [0.001 seconds]
Headache
/Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:30
  updates the header according to the header parameters [It]
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:109

  Test Panicked
  
  
  mock: Unexpected Method Call
  -----------------------------
  
  Write([]uint8)
                0: []byte{0x2f, 0x2f, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0xa, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x2e, 0xa, 0xa, 0x2f, 0x2f, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0xa, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x53, 0x6f, 0x6c, 0x6f, 0x69, 0x6e, 0x67, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0xa, 0xa, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x77, 0x6f, 0x72, 0x6c, 0x64}
  
  The closest call I have is: 
  
  Write([]uint8)
                0: []byte{0x2f, 0x2f, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0xa, 0x2f, 0x2f, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x65, 0x78, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x50, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x2e, 0xa, 0xa, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x77, 0x6f, 0x72, 0x6c, 0x64}
  
  Difference found in argument 0:
  
  --- Expected
  +++ Actual
  @@ -1,2 +1,2 @@
  -([]uint8) (len=76) {
  +([]uint8) (len=140) {
    00000000  2f 2f 20 73 6f 6d 65 20  6d 75 6c 74 69 2d 6c 69  |// some multi-li|
  @@ -5,3 +5,7 @@
    00000030  6d 20 50 61 69 72 69 6e  67 20 43 6f 72 70 2e 0a  |m Pairing Corp..|
  - 00000040  0a 68 65 6c 6c 6f 0a 77  6f 72 6c 64              |.hello.world|
  + 00000040  0a 2f 2f 20 73 6f 6d 65  20 6d 75 6c 74 69 2d 6c  |.// some multi-l|
  + 00000050  69 6e 65 20 68 65 61 64  65 72 20 0a 2f 2f 20 77  |ine header .// w|
  + 00000060  69 74 68 20 73 6f 6d 65  20 74 65 78 74 20 66 72  |ith some text fr|
  + 00000070  6f 6d 20 53 6f 6c 6f 69  6e 67 20 49 6e 63 2e 0a  |om Soloing Inc..|
  + 00000080  0a 68 65 6c 6c 6f 0a 77  6f 72 6c 64              |.hello.world|
   }
  
  Diff: 0: FAIL:  ([]uint8=[47 47 32 115 111 109 101 32 109 117 108 116 105 45 108 105 110 101 32 104 101 97 100 101 114 32 10 47 47 32 119 105 116 104 32 115 111 109 101 32 116 101 120 116 32 102 114 111 109 32 80 97 105 114 105 110 103 32 67 111 114 112 46 10 10 47 47 32 115 111 109 101 32 109 117 108 116 105 45 108 105 110 101 32 104 101 97 100 101 114 32 10 47 47 32 119 105 116 104 32 115 111 109 101 32 116 101 120 116 32 102 114 111 109 32 83 111 108 111 105 110 103 32 73 110 99 46 10 10 104 101 108 108 111 10 119 111 114 108 100]) != ([]uint8=[47 47 32 115 111 109 101 32 109 117 108 116 105 45 108 105 110 101 32 104 101 97 100 101 114 32 10 47 47 32 119 105 116 104 32 115 111 109 101 32 116 101 120 116 32 102 114 111 109 32 80 97 105 114 105 110 103 32 67 111 114 112 46 10 10 104 101 108 108 111 10 119 111 114 108 100])
  /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236

  Full Stack Trace
  github.com/stretchr/testify/mock.(*Mock).fail(0xc0003788c0, 0x158e08d, 0x6f, 0xc000322740, 0x4, 0x4)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236 +0x17c
  github.com/stretchr/testify/mock.(*Mock).MethodCalled(0xc0003788c0, 0x192b0fb, 0x5, 0xc0002f86e0, 0x1, 0x1, 0xc000322700, 0x4, 0x4)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:366 +0x662
  github.com/stretchr/testify/mock.(*Mock).Called(0xc0003788c0, 0xc0002f86e0, 0x1, 0x1, 0xc0003788c0, 0xc000484440, 0xc0002fe3c0)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:338 +0x1a7
  github.com/fbiville/headache/internal/pkg/fs_mocks.(*File).Write(0xc0003788c0, 0xc0001e2e60, 0x8c, 0xa0, 0xc040000000, 0x6315440)
        /Users/adrienjoly/Downloads/headache/internal/pkg/fs_mocks/File.go:28 +0xb2
  github.com/fbiville/headache/internal/pkg/core.(*Headache).writeToFile(0xc000122840, 0x1571ce6, 0xb, 0xc0001e2e60, 0x8c, 0xa0)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:117 +0x100
  github.com/fbiville/headache/internal/pkg/core.(*Headache).UpdateFile(0xc000122840, 0x1571ce6, 0xb, 0x0, 0x0, 0xc0002e2b40, 0x158a860, 0x3f)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:63 +0x3d3
  github.com/fbiville/headache/internal/pkg/core.(*Headache).Run(0xc000122840, 0xc0000b1300)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:39 +0xc8
  github.com/fbiville/headache/internal/pkg/core_test.glob..func5.5()
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:132 +0x772
  github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync(0xc00045c540, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/runner.go:113 +0xa3
  github.com/onsi/ginkgo/internal/leafnodes.(*runner).run(0xc00045c540, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/runner.go:64 +0xcf
  github.com/onsi/ginkgo/internal/leafnodes.(*ItNode).Run(0xc00039fe80, 0x16271a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/it_node.go:26 +0x64
  github.com/onsi/ginkgo/internal/spec.(*Spec).runSample(0xc0004fb1d0, 0x0, 0x16271a0, 0xc000130c40)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/spec/spec.go:215 +0x638
  github.com/onsi/ginkgo/internal/spec.(*Spec).Run(0xc0004fb1d0, 0x16271a0, 0xc000130c40)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/spec/spec.go:138 +0xf2
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runSpec(0xc000162000, 0xc0004fb1d0, 0x0)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:200 +0x10f
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runSpecs(0xc000162000, 0x1)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:170 +0x120
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run(0xc000162000, 0xc000126088)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:66 +0x117
  github.com/onsi/ginkgo/internal/suite.(*Suite).Run(0xc000148370, 0x6365880, 0xc000154b40, 0x1570a66, 0xa, 0xc0004697e0, 0x1, 0x1, 0x16322a0, 0xc000130c40, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/suite/suite.go:62 +0x42b
  github.com/onsi/ginkgo.RunSpecsWithCustomReporters(0x16277c0, 0xc000154b40, 0x1570a66, 0xa, 0xc00003a728, 0x1, 0x1, 0x100ea68)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/ginkgo_dsl.go:226 +0x217
  github.com/onsi/ginkgo.RunSpecs(0x16277c0, 0xc000154b40, 0x1570a66, 0xa, 0x13d46474271f8)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/ginkgo_dsl.go:207 +0x16e
  github.com/fbiville/headache/internal/pkg/core_test.TestCore(0xc000154b40)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/core_suite_test.go:28 +0x96
  testing.tRunner(0xc000154b40, 0x1597bf0)
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0xdc
  created by testing.(*T).Run
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1043 +0x357
------------------------------
••••PASS:       Read(string)
PASS:   Open(string,int,os.FileMode)

------------------------------
•! Panic [0.003 seconds]
Headache
/Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:30
  matches similar header with punctuation variation and replaces it [It]
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:235

  Test Panicked
  
  
  mock: Unexpected Method Call
  -----------------------------
  
  Write([]uint8)
                0: []byte{0x2f, 0x2f, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x32, 0x30, 0x32, 0x32, 0x2d, 0x32, 0x30, 0x32, 0x34, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74, 0x75, 0x66, 0x66, 0xa, 0xa, 0x20, 0x2a, 0x20, 0x20, 0x20, 0x53, 0x6f, 0x6d, 0x65, 0x20, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x32, 0x30, 0x32, 0x32, 0x20, 0x2d, 0x20, 0x20, 0x20, 0x32, 0x30, 0x32, 0x33, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74, 0x75, 0x66, 0x66, 0x20, 0x2e, 0xa, 0x20, 0x2a, 0xa, 0x20, 0x2a, 0x2f, 0xa, 0xa, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x77, 0x6f, 0x72, 0x6c, 0x64}
  
  The closest call I have is: 
  
  Write([]uint8)
                0: []byte{0x2f, 0x2f, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x32, 0x30, 0x32, 0x32, 0x2d, 0x32, 0x30, 0x32, 0x34, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x73, 0x74, 0x75, 0x66, 0x66, 0xa, 0xa, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x77, 0x6f, 0x72, 0x6c, 0x64}
  
  Difference found in argument 0:
  
  --- Expected
  +++ Actual
  @@ -1,5 +1,9 @@
  -([]uint8) (len=47) {
  +([]uint8) (len=98) {
    00000000  2f 2f 20 73 6f 6d 65 20  68 65 61 64 65 72 20 32  |// some header 2|
    00000010  30 32 32 2d 32 30 32 34  20 61 6e 64 20 73 74 75  |022-2024 and stu|
  - 00000020  66 66 0a 0a 68 65 6c 6c  6f 0a 77 6f 72 6c 64     |ff..hello.world|
  + 00000020  66 66 0a 0a 20 2a 20 20  20 53 6f 6d 65 20 48 65  |ff.. *   Some He|
  + 00000030  61 64 65 72 20 32 30 32  32 20 2d 20 20 20 32 30  |ader 2022 -   20|
  + 00000040  32 33 20 61 6e 64 20 73  74 75 66 66 20 2e 0a 20  |23 and stuff .. |
  + 00000050  2a 0a 20 2a 2f 0a 0a 68  65 6c 6c 6f 0a 77 6f 72  |*. */..hello.wor|
  + 00000060  6c 64                                             |ld|
   }
  
  Diff: 0: FAIL:  ([]uint8=[47 47 32 115 111 109 101 32 104 101 97 100 101 114 32 50 48 50 50 45 50 48 50 52 32 97 110 100 32 115 116 117 102 102 10 10 32 42 32 32 32 83 111 109 101 32 72 101 97 100 101 114 32 50 48 50 50 32 45 32 32 32 50 48 50 51 32 97 110 100 32 115 116 117 102 102 32 46 10 32 42 10 32 42 47 10 10 104 101 108 108 111 10 119 111 114 108 100]) != ([]uint8=[47 47 32 115 111 109 101 32 104 101 97 100 101 114 32 50 48 50 50 45 50 48 50 52 32 97 110 100 32 115 116 117 102 102 10 10 104 101 108 108 111 10 119 111 114 108 100])
  /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236

  Full Stack Trace
  github.com/stretchr/testify/mock.(*Mock).fail(0xc0004f05a0, 0x158e08d, 0x6f, 0xc000424a40, 0x4, 0x4)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236 +0x17c
  github.com/stretchr/testify/mock.(*Mock).MethodCalled(0xc0004f05a0, 0x192b0fb, 0x5, 0xc000438030, 0x1, 0x1, 0xc000424a00, 0x4, 0x4)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:366 +0x662
  github.com/stretchr/testify/mock.(*Mock).Called(0xc0004f05a0, 0xc000438030, 0x1, 0x1, 0xc0004f05a0, 0xc0003aae80, 0xc000434040)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:338 +0x1a7
  github.com/fbiville/headache/internal/pkg/fs_mocks.(*File).Write(0xc0004f05a0, 0xc000199ab0, 0x62, 0x70, 0xc040000000, 0x6315440)
        /Users/adrienjoly/Downloads/headache/internal/pkg/fs_mocks/File.go:28 +0xb2
  github.com/fbiville/headache/internal/pkg/core.(*Headache).writeToFile(0xc000122aa8, 0x1571ce6, 0xb, 0xc000199ab0, 0x62, 0x70)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:117 +0x100
  github.com/fbiville/headache/internal/pkg/core.(*Headache).UpdateFile(0xc000122aa8, 0x1571ce6, 0xb, 0x7e6, 0x7e8, 0xc0003f3540, 0x157f0f1, 0x22)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:63 +0x3d3
  github.com/fbiville/headache/internal/pkg/core.(*Headache).Run(0xc000122aa8, 0xc0000b1300)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:39 +0xc8
  github.com/fbiville/headache/internal/pkg/core_test.glob..func5.10()
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:261 +0x74b
  github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync(0xc00045c960, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/runner.go:113 +0xa3
  github.com/onsi/ginkgo/internal/leafnodes.(*runner).run(0xc00045c960, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/runner.go:64 +0xcf
  github.com/onsi/ginkgo/internal/leafnodes.(*ItNode).Run(0xc0004841c0, 0x16271a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/it_node.go:26 +0x64
  github.com/onsi/ginkgo/internal/spec.(*Spec).runSample(0xc0004fb680, 0x0, 0x16271a0, 0xc000130c40)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/spec/spec.go:215 +0x638
  github.com/onsi/ginkgo/internal/spec.(*Spec).Run(0xc0004fb680, 0x16271a0, 0xc000130c40)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/spec/spec.go:138 +0xf2
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runSpec(0xc000162000, 0xc0004fb680, 0x0)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:200 +0x10f
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runSpecs(0xc000162000, 0x1)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:170 +0x120
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run(0xc000162000, 0xc000126088)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:66 +0x117
  github.com/onsi/ginkgo/internal/suite.(*Suite).Run(0xc000148370, 0x6365880, 0xc000154b40, 0x1570a66, 0xa, 0xc0004697e0, 0x1, 0x1, 0x16322a0, 0xc000130c40, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/suite/suite.go:62 +0x42b
  github.com/onsi/ginkgo.RunSpecsWithCustomReporters(0x16277c0, 0xc000154b40, 0x1570a66, 0xa, 0xc00003a728, 0x1, 0x1, 0x100ea68)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/ginkgo_dsl.go:226 +0x217
  github.com/onsi/ginkgo.RunSpecs(0x16277c0, 0xc000154b40, 0x1570a66, 0xa, 0x13d46474271f8)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/ginkgo_dsl.go:207 +0x16e
  github.com/fbiville/headache/internal/pkg/core_test.TestCore(0xc000154b40)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/core_suite_test.go:28 +0x96
  testing.tRunner(0xc000154b40, 0x1597bf0)
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0xdc
  created by testing.(*T).Run
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1043 +0x357
------------------------------
PASS:   Read(string)
PASS:   Open(string,int,os.FileMode)
•! Panic [0.002 seconds]
Headache
/Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:30
  preserves existing start year when it is lower than the configured one [It]
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:264

  Test Panicked
  
  
  mock: Unexpected Method Call
  -----------------------------
  
  Write([]uint8)
                0: []byte{0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x31, 0x34, 0x2d, 0x32, 0x30, 0x32, 0x32, 0x20, 0x41, 0x43, 0x4d, 0x45, 0xa, 0xa, 0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x31, 0x34, 0x20, 0x41, 0x43, 0x4d, 0x45, 0xa, 0xa, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x77, 0x6f, 0x72, 0x6c, 0x64}
  
  The closest call I have is: 
  
  Write([]uint8)
                0: []byte{0x2f, 0x2f, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x31, 0x34, 0x2d, 0x32, 0x30, 0x32, 0x32, 0x20, 0x41, 0x43, 0x4d, 0x45, 0xa, 0xa, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa, 0x77, 0x6f, 0x72, 0x6c, 0x64}
  
  Difference found in argument 0:
  
  --- Expected
  +++ Actual
  @@ -1,5 +1,6 @@
  -([]uint8) (len=40) {
  +([]uint8) (len=64) {
    00000000  2f 2f 20 43 6f 70 79 72  69 67 68 74 20 32 30 31  |// Copyright 201|
  - 00000010  34 2d 32 30 32 32 20 41  43 4d 45 0a 0a 68 65 6c  |4-2022 ACME..hel|
  - 00000020  6c 6f 0a 77 6f 72 6c 64                           |lo.world|
  + 00000010  34 2d 32 30 32 32 20 41  43 4d 45 0a 0a 2f 2f 20  |4-2022 ACME..// |
  + 00000020  43 6f 70 79 72 69 67 68  74 20 32 30 31 34 20 41  |Copyright 2014 A|
  + 00000030  43 4d 45 0a 0a 68 65 6c  6c 6f 0a 77 6f 72 6c 64  |CME..hello.world|
   }
  
  Diff: 0: FAIL:  ([]uint8=[47 47 32 67 111 112 121 114 105 103 104 116 32 50 48 49 52 45 50 48 50 50 32 65 67 77 69 10 10 47 47 32 67 111 112 121 114 105 103 104 116 32 50 48 49 52 32 65 67 77 69 10 10 104 101 108 108 111 10 119 111 114 108 100]) != ([]uint8=[47 47 32 67 111 112 121 114 105 103 104 116 32 50 48 49 52 45 50 48 50 50 32 65 67 77 69 10 10 104 101 108 108 111 10 119 111 114 108 100])
  /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236

  Full Stack Trace
  github.com/stretchr/testify/mock.(*Mock).fail(0xc0004f0e10, 0x158e08d, 0x6f, 0xc00046a840, 0x4, 0x4)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236 +0x17c
  github.com/stretchr/testify/mock.(*Mock).MethodCalled(0xc0004f0e10, 0x192b0fb, 0x5, 0xc000439d10, 0x1, 0x1, 0xc00046a800, 0x4, 0x4)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:366 +0x662
  github.com/stretchr/testify/mock.(*Mock).Called(0xc0004f0e10, 0xc000439d10, 0x1, 0x1, 0xc0004f0e10, 0xc0003ab680, 0xc0004351b8)
        /Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:338 +0x1a7
  github.com/fbiville/headache/internal/pkg/fs_mocks.(*File).Write(0xc0004f0e10, 0xc000383500, 0x40, 0x40, 0xc040000000, 0x6315440)
        /Users/adrienjoly/Downloads/headache/internal/pkg/fs_mocks/File.go:28 +0xb2
  github.com/fbiville/headache/internal/pkg/core.(*Headache).writeToFile(0xc000122b28, 0x1571ce6, 0xb, 0xc000383500, 0x40, 0x40)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:117 +0x100
  github.com/fbiville/headache/internal/pkg/core.(*Headache).UpdateFile(0xc000122b28, 0x1571ce6, 0xb, 0x7e0, 0x7e6, 0xc000446aa0, 0x157ae5f, 0x1b)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:63 +0x3d3
  github.com/fbiville/headache/internal/pkg/core.(*Headache).Run(0xc000122b28, 0xc0000b1300)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache.go:39 +0xc8
  github.com/fbiville/headache/internal/pkg/core_test.glob..func5.11()
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/headache_test.go:290 +0x7b5
  github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync(0xc00045ca20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/runner.go:113 +0xa3
  github.com/onsi/ginkgo/internal/leafnodes.(*runner).run(0xc00045ca20, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/runner.go:64 +0xcf
  github.com/onsi/ginkgo/internal/leafnodes.(*ItNode).Run(0xc000484260, 0x16271a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/leafnodes/it_node.go:26 +0x64
  github.com/onsi/ginkgo/internal/spec.(*Spec).runSample(0xc0004fb770, 0x0, 0x16271a0, 0xc000130c40)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/spec/spec.go:215 +0x638
  github.com/onsi/ginkgo/internal/spec.(*Spec).Run(0xc0004fb770, 0x16271a0, 0xc000130c40)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/spec/spec.go:138 +0xf2
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runSpec(0xc000162000, 0xc0004fb770, 0x0)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:200 +0x10f
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).runSpecs(0xc000162000, 0x1)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:170 +0x120
  github.com/onsi/ginkgo/internal/specrunner.(*SpecRunner).Run(0xc000162000, 0xc000126088)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/specrunner/spec_runner.go:66 +0x117
  github.com/onsi/ginkgo/internal/suite.(*Suite).Run(0xc000148370, 0x6365880, 0xc000154b40, 0x1570a66, 0xa, 0xc0004697e0, 0x1, 0x1, 0x16322a0, 0xc000130c40, ...)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/internal/suite/suite.go:62 +0x42b
  github.com/onsi/ginkgo.RunSpecsWithCustomReporters(0x16277c0, 0xc000154b40, 0x1570a66, 0xa, 0xc00003a728, 0x1, 0x1, 0x100ea68)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/ginkgo_dsl.go:226 +0x217
  github.com/onsi/ginkgo.RunSpecs(0x16277c0, 0xc000154b40, 0x1570a66, 0xa, 0x13d46474271f8)
        /Users/adrienjoly/go/pkg/mod/github.com/onsi/[email protected]/ginkgo_dsl.go:207 +0x16e
  github.com/fbiville/headache/internal/pkg/core_test.TestCore(0xc000154b40)
        /Users/adrienjoly/Downloads/headache/internal/pkg/core/core_suite_test.go:28 +0x96
  testing.tRunner(0xc000154b40, 0x1597bf0)
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0xdc
  created by testing.(*T).Run
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1043 +0x357
------------------------------
••••••••••2020/04/28 20:26:46 Previous execution's configuration and header not found
2020/04/28 20:26:46 Assuming unchanged configuration and header
•••••2020/04/28 20:26:46 Retrieving former header template by versioning (legacy)
2020/04/28 20:26:46 Last tracked execution: b7c7db75695d8ffff37d556780a616ffbf5c2696
2020/04/28 20:26:46 Make sure the configuration and header template have not been manually committed since
2020/04/28 20:26:46 Previous execution's configuration path not found, assuming current one: /path/to/headache.json
••2020/04/28 20:26:46 Could not get previous execution revision
2020/04/28 20:26:46 Retrieving former header template by versioning (legacy)
•2020/04/28 20:26:46 Retrieving former header template by versioning (legacy)
2020/04/28 20:26:46 Last tracked execution: b7c7db75695d8ffff37d556780a616ffbf5c2696
2020/04/28 20:26:46 Make sure the configuration and header template have not been manually committed since
2020/04/28 20:26:46 Previous execution's configuration path not found, assuming current one: /path/to/headache.json
•2020/04/28 20:26:46 Retrieving former header template by versioning (legacy)
2020/04/28 20:26:46 Last tracked execution: b7c7db75695d8ffff37d556780a616ffbf5c2696
2020/04/28 20:26:46 Make sure the configuration and header template have not been manually committed since
2020/04/28 20:26:46 Previous execution's configuration path not found, assuming current one: /path/to/headache.json
•2020/04/28 20:26:46 Retrieving former header template by versioning (legacy)
2020/04/28 20:26:46 Last tracked execution: b7c7db75695d8ffff37d556780a616ffbf5c2696
2020/04/28 20:26:46 Make sure the configuration and header template have not been manually committed since
2020/04/28 20:26:46 Configuration file path at last execution was: /path/to/former/headache.json
•2020/04/28 20:26:46 Retrieving former header template by encoded configuration
•2020/04/28 20:26:46 Retrieving former header template by encoded configuration
•2020/04/28 20:26:46 Retrieving former header template by encoded configuration
•2020/04/28 20:26:46 Retrieving former header template by encoded configuration
•2020/04/28 20:26:46 Retrieving former header template by encoded configuration
•••••••••
------------------------------
• Failure [0.000 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with a simple header and source file without... source
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:30
    should detect it [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:35

    Expected
        <[]int | len:2, cap:2>: [0, 0]
    to equal
        <[]int | len:2, cap:2>: [0, 43]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:41
------------------------------
• Failure [0.001 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with a simple header and source file
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:45
    should detect it [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:52

    Expected
        <[]int | len:2, cap:2>: [0, 0]
    to equal
        <[]int | len:2, cap:2>: [0, 44]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:58
------------------------------
• Failure [0.001 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with whitespace variations
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:62
    should detect it [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:71

    Expected
        <[]int | len:2, cap:2>: [0, 11]
    to equal
        <[]int | len:2, cap:2>: [0, 87]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:77
------------------------------
• Failure [0.002 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with newline variations
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:81
    should detect it [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:92

    Expected
        <[]int | len:2, cap:2>: [0, 0]
    to equal
        <[]int | len:2, cap:2>: [0, 50]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:98
------------------------------
• Failure [0.001 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with newline and whitespace variations
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:102
    should detect it [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:115

    Expected
        <[]int | len:2, cap:2>: [0, 6]
    to equal
        <[]int | len:2, cap:2>: [0, 87]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:121
------------------------------
• Failure [0.001 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with punctuation and whitespace variations in the source file
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:125
    should detect it [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:133

    Expected
        <[]int | len:2, cap:2>: [0, 0]
    to equal
        <[]int | len:2, cap:2>: [0, 51]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:139
------------------------------
• Failure [0.001 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with punctuation and whitespace variations in the license header template
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:143
    should detect it [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:151

    Expected
        <[]int | len:2, cap:2>: [0, 0]
    to equal
        <[]int | len:2, cap:2>: [0, 44]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:157
------------------------------
• Failure [0.002 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with whitespaces variations with comment style symbols including whitespaces
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:161
    should detect it [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:172

    Expected
        <[]int | len:2, cap:2>: [0, 3]
    to equal
        <[]int | len:2, cap:2>: [0, 51]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:178
------------------------------
••
------------------------------
• Failure [0.001 seconds]
Header detector
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:28
  with a realistic header
  /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:182
    computes a regex to match existing header [It]
    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:239

    Expected
        <[]int | len:2, cap:2>: [0, 2]
    to equal
        <[]int | len:2, cap:2>: [0, 610]

    /Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:249
------------------------------
••••••••2020/04/28 20:26:46 Scanning changes since revision some-sha
•2020/04/28 20:26:46 Scanning changes since revision some-sha
•2020/04/28 20:26:46 Scanning changes since revision some-sha
•2020/04/28 20:26:46 Scanning changes since revision some-sha
•2020/04/28 20:26:46 Scanning changes since revision some-sha
•2020/04/28 20:26:46 Scanning changes since revision some-sha
•2020/04/28 20:26:46 Scanning changes since revision some-sha
•2020/04/28 20:26:46 Scanning changes since revision some-sha
•2020/04/28 20:26:46 Configuration and/or license header template changed since last execution (some-sha), triggering a full scan
•

Summarizing 13 Failures:

[Panic!] Headache [It] updates the header according to the comment style 
/Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236

[Panic!] Headache [It] updates the header according to the header parameters 
/Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236

[Panic!] Headache [It] matches similar header with punctuation variation and replaces it 
/Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236

[Panic!] Headache [It] preserves existing start year when it is lower than the configured one 
/Users/adrienjoly/go/pkg/mod/github.com/stretchr/[email protected]/mock/mock.go:236

[Fail] Header detector with a simple header and source file without... source [It] should detect it 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:41

[Fail] Header detector with a simple header and source file [It] should detect it 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:58

[Fail] Header detector with whitespace variations [It] should detect it 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:77

[Fail] Header detector with newline variations [It] should detect it 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:98

[Fail] Header detector with newline and whitespace variations [It] should detect it 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:121

[Fail] Header detector with punctuation and whitespace variations in the source file [It] should detect it 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:139

[Fail] Header detector with punctuation and whitespace variations in the license header template [It] should detect it 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:157

[Fail] Header detector with whitespaces variations with comment style symbols including whitespaces [It] should detect it 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:178

[Fail] Header detector with a realistic header [It] computes a regex to match existing header 
/Users/adrienjoly/Downloads/headache/internal/pkg/core/header_detector_test.go:249

Ran 88 of 88 Specs in 0.059 seconds
FAIL! -- 75 Passed | 13 Failed | 0 Pending | 0 Skipped
--- FAIL: TestCore (0.06s)
FAIL
FAIL    github.com/fbiville/headache/internal/pkg/core  0.102s
?       github.com/fbiville/headache/internal/pkg/core/comment_styles   [no test files]
?       github.com/fbiville/headache/internal/pkg/core_mocks    [no test files]
=== RUN   TestCore
Running Suite: Filesystem Suite
===============================
Random Seed: 1588096827
Will run 2 of 2 specs

••
Ran 2 of 2 Specs in 0.004 seconds
SUCCESS! -- 2 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestCore (0.00s)
PASS
ok      github.com/fbiville/headache/internal/pkg/fs    (cached)
?       github.com/fbiville/headache/internal/pkg/fs_mocks      [no test files]
=== RUN   TestCore
Running Suite: Helper Suite
===========================
Random Seed: 1588097486
Will run 6 of 6 specs

••••••
Ran 6 of 6 Specs in 0.045 seconds
SUCCESS! -- 6 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestCore (0.05s)
PASS
ok      github.com/fbiville/headache/internal/pkg/helper        (cached)
?       github.com/fbiville/headache/internal/pkg/helper_mocks  [no test files]
=== RUN   TestCore
Running Suite: VCS Suite
========================
Random Seed: 1588096828
Will run 9 of 9 specs

•••••••••
Ran 9 of 9 Specs in 0.003 seconds
SUCCESS! -- 9 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestCore (0.00s)
PASS
ok      github.com/fbiville/headache/internal/pkg/vcs   (cached)
?       github.com/fbiville/headache/internal/pkg/vcs_mocks     [no test files]
FAIL
make: *** [test] Error 1
➜  headache git:(feat/add-xml-format) ✗ 

=> hypothesis: `!` is not escaped properly
by replacing HTML templating (causing escape to &lt; entities) by Text templates
@adrienjoly adrienjoly marked this pull request as ready for review April 28, 2020 19:47
@adrienjoly
Copy link
Contributor Author

adrienjoly commented Apr 28, 2020

FYI, here's the vscode configuration we used for debugging, during the hackergarten session:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch remote",
      "type": "go",
      "request": "launch",
      "mode": "remote",
      "remotePath": "/Users/adrienjoly/go/bin/headache
",
      "port": 2345,
      "host": "127.0.0.1",
      "program": "/Users/adrienjoly/go/bin/headache
",
      "env": {}
    }
  ]
}

And the command I ran in my sample headache-test directory:

$ 
go get -u github.com/go-delve/delve/cmd/dlv

$ $(go env GOPATH)/bin/dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec $(go env GOPATH)/bin/headache

Source: https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code#remote-debugging

@fbiville
Copy link
Owner

fbiville commented May 1, 2020

Merged as 72519da, thanks!

@fbiville fbiville closed this May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants