Skip to content

Commit 67f5d04

Browse files
authored
Add Kotlin code sample for tests. Fixes #38 (#46)
1 parent 28c6467 commit 67f5d04

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

pkg/analyzer/analyzer_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ func TestMatchingFiles(t *testing.T) {
9292
Extension: ".rb",
9393
Language: "Ruby",
9494
},
95+
{
96+
FilePath: filepath.Join(codeSamplesDir, "Main.kt"),
97+
Extension: ".kt",
98+
Language: "Kotlin",
99+
},
95100
},
96101
},
97102
{
@@ -144,6 +149,11 @@ func TestMatchingFiles(t *testing.T) {
144149
Extension: ".rb",
145150
Language: "Ruby",
146151
},
152+
{
153+
FilePath: filepath.Join(codeSamplesDir, "Main.kt"),
154+
Extension: ".kt",
155+
Language: "Kotlin",
156+
},
147157
},
148158
},
149159
{
@@ -196,6 +206,11 @@ func TestMatchingFiles(t *testing.T) {
196206
Extension: ".rb",
197207
Language: "Ruby",
198208
},
209+
{
210+
FilePath: filepath.Join(codeSamplesDir, "Main.kt"),
211+
Extension: ".kt",
212+
Language: "Kotlin",
213+
},
199214
},
200215
},
201216
{

pkg/scanner/scanner_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ func TestScan(t *testing.T) {
6868
Extension: ".rb",
6969
Language: "Ruby",
7070
},
71+
{
72+
FilePath: filepath.Join(codeSamplesDir, "Main.kt"),
73+
Extension: ".kt",
74+
Language: "Kotlin",
75+
},
7176
}
7277

7378
expected := []scanResult{
@@ -134,6 +139,13 @@ func TestScan(t *testing.T) {
134139
BlankLines: 4,
135140
Comments: 8,
136141
},
142+
{
143+
Metadata: files[9],
144+
Lines: 15,
145+
CodeLines: 7,
146+
BlankLines: 3,
147+
Comments: 5,
148+
},
137149
}
138150

139151
result, err := scanner.Scan(files)

test/fixtures/code_samples/Main.kt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
fun main() {
2+
println("Hello, world")
3+
4+
/* This is a block comment
5+
* extending to 4 lines
6+
* ends
7+
*/
8+
9+
val a = 5
10+
val b = 6
11+
// sum = a + b
12+
val sum = a + b
13+
14+
println(sum)
15+
}

0 commit comments

Comments
 (0)