Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case for remove_dupes with SQL_ASCII test case #54

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ohloh_scm/adapters/svn/commits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def recurse_files(path=nil, revision=final_token || 'HEAD')

files = []
stdout.each_line do |s|
s.chomp!
s.chomp!.force_encoding('UTF-8')
files << s if s.length > 0 and s !~ /CVSROOT\// and s[-1..-1] != '/'
end
files.sort
Expand Down
13 changes: 13 additions & 0 deletions test/unit/svn_commits_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,19 @@ def test_remove_dupes_add_replace
assert_equal 'A', c.diffs.first.action
end

def test_remove_dupes_with_sql_acii_encoding
#Note: If there are two files that are identical except for the encoding, ohloh_scm should only keep one.
svn = SvnAdapter.new
diff_1 = OhlohScm::Diff.new(:action => "M", :path => "/FritzBoxDial/FritzBoxDial/formWählbox.vb")
diff_2 = OhlohScm::Diff.new(:action => "A", :path => "/FritzBoxDial/FritzBoxDial/formWählbox.vb")
c = OhlohScm::Commit.new(:diffs => [diff_1 ,diff_2])

svn.remove_dupes(c)
puts c.diffs.count
assert_equal 1, c.diffs.size
assert_equal 'A', c.diffs.first.action
end

# Had so many bugs around this case that a test was required
def test_deepen_commit_with_nil_diffs
with_svn_repository('svn') do |svn|
Expand Down