Repository navigation
Raise test coverage and fix the bugs the new tests exposed - #203
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five files sat below 85% line coverage and several methods had no tests. This adds tests for them and fixes the bugs the new tests exposed. Each fix comes with a test that failed before the fix.
Coverage
bibliography/rdf_converter.rbcompatibility.rberror.rbelements.rbreplaceable.rbAlso covered:
Names#add,Name#rename_unless,Name.looks_like?,Value#replaceandEntry#type?. Overall line coverage goes from 90.2% to 94.0%.The new tests are unit tests, because the logic is pure and the cucumber features already cover the end-to-end flows. The
error.rbtests go through the public parse path (parse, thenbib.errors).Test files
New:
test_bibliography_rdf_converter.rbtest_compatibility.rbtest_error.rbtest_replaceable.rbExtended:
test_elements.rb: defaults, conversions, conditions and matchingtest_names.rb:Names#add,Name.looks_like?,Name#rename_unlesstest_value.rb:Value#replacetest_entry.rb:Entry#type?Bugs fixed
BibTeX::String#to_xmlcalledadd_elements, which REXML does not have (NoMethodError).Element#type?andEntry#type?raisedNoMethodErrorfor a Class argument. InElement#type?thedefined?(type)guard checked a local variable, so the class branch never ran.Element#to_xmlwith a symbol type produced<>blah</>.prop=~rewas split as equality with the value~re, because the=alternative matched first. It now matches a regular expression, like~=.Names#addwith a String raisedTypeError, because it added aNamesto an Array.Name.looks_like?raisedNameError(undefined local) and had its result inverted.Behaviour change
prop=~reused to mean equality with~re. It now means a regular-expression match. The old reading could not have been intended, since=~is already handled in the operatorcase. It is listed inHistory.txt.Not changed
Name#rename_unlesswith no conditions never renames. That is the exact complement ofrename_if, which renames when no conditions are given, so a test pins it.Test plan
bundle exec rakepasses locally with 1010 unit tests and 141 cucumber scenarios.rubocopis clean.