google / addlicense

A program which ensures source code files have copyright license headers by scanning directory patterns recursively
Apache License 2.0
724 stars 170 forks source link

tests: add unit tests for header and template funcs #85

Closed willnorris closed 3 years ago

willnorris commented 3 years ago

This begins to add unit tests for some of the core functionality in addlicense. Much of this is being tested with the existing integration-style tests using the files in testdata/*, but this moves us toward a much more targetted and simpler test structure. This also tests functionality in a fashion that coverage analysis tools have visibility into it.

This also actually found one minor bug I introduced with the SPDX support :)

codecov-commenter commented 3 years ago

Codecov Report

Merging #85 (b85fb71) into master (ef04bb3) will increase coverage by 35.77%. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #85       +/-   ##
===========================================
+ Coverage   11.20%   46.98%   +35.77%     
===========================================
  Files           2        2               
  Lines         232      232               
===========================================
+ Hits           26      109       +83     
+ Misses        203      116       -87     
- Partials        3        7        +4     
Impacted Files Coverage Δ
main.go 38.94% <100.00%> (+35.78%) :arrow_up:
tmpl.go 83.33% <0.00%> (+35.71%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ef04bb3...b85fb71. Read the comment docs.