blob: 033043375c096c2366e6836e497e3a32ed8f6e4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package main
import (
"testing"
)
func TestChangeLogParser(t *testing.T) {
commitText := `
Some text here
[ChangeLog] Multi line text
here
more text here
`
entry := extractChangeLog(commitText)
if entry.module != "" || entry.class != "" {
t.Fatal("Unexpected groups parsed")
}
if entry.text != "Multi line text here" {
t.Fatalf("Unexpected text extracted: %s", entry.text)
}
commitText = `
Some text here
[ChangeLog][Some][Group] Multi line text
here
more text here
`
entry = extractChangeLog(commitText)
if entry.module != "Some" && entry.class != "Group" {
t.Fatalf("Groups incorrectly parsed: %s %s", entry.class, entry.module)
}
if entry.text != "Multi line text here" {
t.Fatalf("Unexpected text extracted: %s", entry.text)
}
}
func TestTaskExtraction(t *testing.T) {
commitText := `
Some text here
[ChangeLog] Blah
Task-Number: QTBUG-1234
`
entry := extractChangeLog(commitText)
if entry.text != "[QTBUG-1234] Blah" {
t.Fatalf("Unexpected text extracted: %s", entry.text)
}
}
|