@@ -6,10 +6,9 @@ import (
66 "strings"
77 "testing"
88
9+ "github.com/conventionalcommit/parser"
910 "github.com/stretchr/testify/assert"
1011 "github.com/stretchr/testify/suite"
11-
12- . "github.com/conventionalcommit/parser"
1312)
1413
1514const (
@@ -26,17 +25,17 @@ const (
2625 testDataDir = "testdata"
2726)
2827
29- var breakingChangeFooter = Footer {
30- Notes : []FooterNote {
28+ var breakingChangeFooter = parser. Footer {
29+ Notes : []parser. FooterNote {
3130 {
3231 Token : "BREAKING CHANGE" ,
3332 Value : "reason" ,
3433 },
3534 },
3635}
3736
38- var commitFooters = Footer {
39- Notes : []FooterNote {
37+ var commitFooters = parser. Footer {
38+ Notes : []parser. FooterNote {
4039 {
4140 Token : "footer" ,
4241 Value : "simple" ,
@@ -58,8 +57,8 @@ type parserSuite struct {
5857}
5958
6059func (s * parserSuite ) TestDescription () {
61- expectedCommit := & Commit {
62- Header : Header {
60+ expectedCommit := & parser. Commit {
61+ Header : parser. Header {
6362 Type : commitType ,
6463 Description : commitDescription ,
6564 },
@@ -68,8 +67,8 @@ func (s *parserSuite) TestDescription() {
6867}
6968
7069func (s * parserSuite ) TestDescriptionScope () {
71- expectedCommit := & Commit {
72- Header : Header {
70+ expectedCommit := & parser. Commit {
71+ Header : parser. Header {
7372 Type : commitType ,
7473 Scope : commitScope ,
7574 Description : commitDescription ,
@@ -79,8 +78,8 @@ func (s *parserSuite) TestDescriptionScope() {
7978}
8079
8180func (s * parserSuite ) TestBreakingChangeDescription () {
82- expectedCommit := & Commit {
83- Header : Header {
81+ expectedCommit := & parser. Commit {
82+ Header : parser. Header {
8483 Type : commitType ,
8584 Description : commitDescription ,
8685 },
@@ -90,8 +89,8 @@ func (s *parserSuite) TestBreakingChangeDescription() {
9089}
9190
9291func (s * parserSuite ) TestBreakingChangeDescriptionScope () {
93- expectedCommit := & Commit {
94- Header : Header {
92+ expectedCommit := & parser. Commit {
93+ Header : parser. Header {
9594 Type : commitType ,
9695 Scope : commitScope ,
9796 Description : commitDescription ,
@@ -102,8 +101,8 @@ func (s *parserSuite) TestBreakingChangeDescriptionScope() {
102101}
103102
104103func (s * parserSuite ) TestDescriptionBody () {
105- expectedCommit := & Commit {
106- Header : Header {
104+ expectedCommit := & parser. Commit {
105+ Header : parser. Header {
107106 Type : commitType ,
108107 Description : commitDescription ,
109108 },
@@ -113,8 +112,8 @@ func (s *parserSuite) TestDescriptionBody() {
113112}
114113
115114func (s * parserSuite ) TestDescriptionScopeBody () {
116- expectedCommit := & Commit {
117- Header : Header {
115+ expectedCommit := & parser. Commit {
116+ Header : parser. Header {
118117 Type : commitType ,
119118 Scope : commitScope ,
120119 Description : commitDescription ,
@@ -125,8 +124,8 @@ func (s *parserSuite) TestDescriptionScopeBody() {
125124}
126125
127126func (s * parserSuite ) TestBreakingChangeDescriptionBody () {
128- expectedCommit := & Commit {
129- Header : Header {
127+ expectedCommit := & parser. Commit {
128+ Header : parser. Header {
130129 Type : commitType ,
131130 Description : commitDescription ,
132131 },
@@ -137,8 +136,8 @@ func (s *parserSuite) TestBreakingChangeDescriptionBody() {
137136}
138137
139138func (s * parserSuite ) TestBreakingChangeDescriptionScopeBody () {
140- expectedCommit := & Commit {
141- Header : Header {
139+ expectedCommit := & parser. Commit {
140+ Header : parser. Header {
142141 Type : commitType ,
143142 Scope : commitScope ,
144143 Description : commitDescription ,
@@ -150,8 +149,8 @@ func (s *parserSuite) TestBreakingChangeDescriptionScopeBody() {
150149}
151150
152151func (s * parserSuite ) TestDescriptionFooters () {
153- expectedCommit := & Commit {
154- Header : Header {
152+ expectedCommit := & parser. Commit {
153+ Header : parser. Header {
155154 Type : commitType ,
156155 Description : commitDescription ,
157156 },
@@ -161,8 +160,8 @@ func (s *parserSuite) TestDescriptionFooters() {
161160}
162161
163162func (s * parserSuite ) TestDescriptionScopeFooters () {
164- expectedCommit := & Commit {
165- Header : Header {
163+ expectedCommit := & parser. Commit {
164+ Header : parser. Header {
166165 Type : commitType ,
167166 Scope : commitScope ,
168167 Description : commitDescription ,
@@ -173,8 +172,8 @@ func (s *parserSuite) TestDescriptionScopeFooters() {
173172}
174173
175174func (s * parserSuite ) TestDescriptionBodyFooters () {
176- expectedCommit := & Commit {
177- Header : Header {
175+ expectedCommit := & parser. Commit {
176+ Header : parser. Header {
178177 Type : commitType ,
179178 Description : commitDescription ,
180179 },
@@ -185,8 +184,8 @@ func (s *parserSuite) TestDescriptionBodyFooters() {
185184}
186185
187186func (s * parserSuite ) TestDescriptionScopeBodyFooters () {
188- expectedCommit := & Commit {
189- Header : Header {
187+ expectedCommit := & parser. Commit {
188+ Header : parser. Header {
190189 Type : commitType ,
191190 Scope : commitScope ,
192191 Description : commitDescription ,
@@ -198,8 +197,8 @@ func (s *parserSuite) TestDescriptionScopeBodyFooters() {
198197}
199198
200199func (s * parserSuite ) TestDescriptionFootersBreakingChange () {
201- expectedCommit := & Commit {
202- Header : Header {
200+ expectedCommit := & parser. Commit {
201+ Header : parser. Header {
203202 Type : commitType ,
204203 Description : commitDescription ,
205204 },
@@ -210,9 +209,9 @@ func (s *parserSuite) TestDescriptionFootersBreakingChange() {
210209}
211210
212211func (s * parserSuite ) TestBreakingChangeDescriptionFooters () {
213- expectedCommit := & Commit {
212+ expectedCommit := & parser. Commit {
214213 BreakingChange : true ,
215- Header : Header {
214+ Header : parser. Header {
216215 Type : commitType ,
217216 Description : commitDescription ,
218217 },
@@ -222,9 +221,9 @@ func (s *parserSuite) TestBreakingChangeDescriptionFooters() {
222221}
223222
224223func (s * parserSuite ) TestBreakingChangeDescriptionBodyFooters () {
225- expectedCommit := & Commit {
224+ expectedCommit := & parser. Commit {
226225 BreakingChange : true ,
227- Header : Header {
226+ Header : parser. Header {
228227 Type : commitType ,
229228 Description : commitDescription ,
230229 },
@@ -235,8 +234,8 @@ func (s *parserSuite) TestBreakingChangeDescriptionBodyFooters() {
235234}
236235
237236func (s * parserSuite ) TestBreakingChangeDescriptionScopeFooters () {
238- expectedCommit := & Commit {
239- Header : Header {
237+ expectedCommit := & parser. Commit {
238+ Header : parser. Header {
240239 Type : commitType ,
241240 Scope : commitScope ,
242241 Description : commitDescription ,
@@ -248,8 +247,8 @@ func (s *parserSuite) TestBreakingChangeDescriptionScopeFooters() {
248247}
249248
250249func (s * parserSuite ) TestBreakingChangeDescriptionScopeBodyFooters () {
251- expectedCommit := & Commit {
252- Header : Header {
250+ expectedCommit := & parser. Commit {
251+ Header : parser. Header {
253252 Type : commitType ,
254253 Scope : commitScope ,
255254 Description : commitDescription ,
@@ -261,12 +260,12 @@ func (s *parserSuite) TestBreakingChangeDescriptionScopeBodyFooters() {
261260 s .parseMsgAndCompare ("breaking_change_description_scope_body_footers" , expectedCommit )
262261}
263262
264- func (s * parserSuite ) parseMsgAndCompare (fileName string , expectedCommit * Commit ) {
263+ func (s * parserSuite ) parseMsgAndCompare (fileName string , expectedCommit * parser. Commit ) {
265264 t := s .T ()
266265 t .Helper ()
267266
268267 commitMsg := s .loadCommitMsgFromFile (filepath .Join (testDataDir , fileName ))
269- actualCommit , err := Parse (commitMsg )
268+ actualCommit , err := parser . Parse (commitMsg )
270269 if err != nil {
271270 t .Errorf ("Received unexpected error:\n %+v" , err )
272271 return
@@ -291,7 +290,7 @@ func (s *parserSuite) loadCommitMsgFromFile(fileName string) string {
291290 return strings .TrimSpace (string (out ))
292291}
293292
294- func (s * parserSuite ) compareCommit (a , b * Commit ) bool {
293+ func (s * parserSuite ) compareCommit (a , b * parser. Commit ) bool {
295294 t := s .T ()
296295
297296 if a .Header .Type != b .Header .Type {
0 commit comments