Skip to content

Commit

Permalink
Merge pull request #16 from erizocosmico/fix/lang
Browse files Browse the repository at this point in the history
add language to result of analysis
  • Loading branch information
hhatto authored May 23, 2019
2 parents b9c5a4a + 37c92a8 commit c5379f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func AnalyzeReader(filename string, language *Language, file io.Reader, opts *Cl

clocFile := &ClocFile{
Name: filename,
Lang: language.Name,
}

isFirstLine := true
Expand Down
18 changes: 18 additions & 0 deletions file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class A:
if clocFile.Code != 3 {
t.Errorf("invalid logic. code=%v", clocFile.Code)
}
if clocFile.Lang != "Python" {
t.Errorf("invalid logic. lang=%v", clocFile.Lang)
}
}

func TestAnalayzeFile4PythonInvalid(t *testing.T) {
Expand Down Expand Up @@ -72,6 +75,9 @@ class A:
if clocFile.Code != 3 {
t.Errorf("invalid logic. code=%v", clocFile.Code)
}
if clocFile.Lang != "Python" {
t.Errorf("invalid logic. lang=%v", clocFile.Lang)
}
}

func TestAnalayzeFile4Go(t *testing.T) {
Expand Down Expand Up @@ -106,6 +112,9 @@ func main() {
if clocFile.Code != 4 {
t.Errorf("invalid logic. code=%v", clocFile.Code)
}
if clocFile.Lang != "Go" {
t.Errorf("invalid logic. lang=%v", clocFile.Lang)
}
}

func TestAnalayzeFile4GoWithOnelineBlockComment(t *testing.T) {
Expand Down Expand Up @@ -141,6 +150,9 @@ func main() {
if clocFile.Code != 6 {
t.Errorf("invalid logic. code=%v", clocFile.Code)
}
if clocFile.Lang != "Go" {
t.Errorf("invalid logic. lang=%v", clocFile.Lang)
}
}

func TestAnalayzeFile4GoWithCommentInnerBlockComment(t *testing.T) {
Expand Down Expand Up @@ -174,6 +186,9 @@ func main() {
if clocFile.Code != 5 {
t.Errorf("invalid logic. code=%v", clocFile.Code)
}
if clocFile.Lang != "Go" {
t.Errorf("invalid logic. lang=%v", clocFile.Lang)
}
}

func TestAnalayzeReader(t *testing.T) {
Expand All @@ -200,4 +215,7 @@ class A:
if clocFile.Code != 3 {
t.Errorf("invalid logic. code=%v", clocFile.Code)
}
if clocFile.Lang != "Python" {
t.Errorf("invalid logic. lang=%v", clocFile.Lang)
}
}

0 comments on commit c5379f7

Please sign in to comment.