From: Matt Amos Date: Sun, 8 Feb 2009 16:33:48 +0000 (+0000) Subject: Test and fix for issue #1568. Wasn't testing for end element in the right place. X-Git-Tag: live~8164^2~67 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/12b779f0b4ad730d42f3042da5da387bc288f929 Test and fix for issue #1568. Wasn't testing for end element in the right place. --- diff --git a/lib/diff_reader.rb b/lib/diff_reader.rb index 3b13e9462..452d73dab 100644 --- a/lib/diff_reader.rb +++ b/lib/diff_reader.rb @@ -47,7 +47,7 @@ class DiffReader # read the first element read_or_die - begin + while @reader.node_type != 15 do # end element # because we read elements in DOM-style to reuse their DOM # parsing code, we don't always read an element on each pass # as the call to @reader.next in the innermost loop will take @@ -57,7 +57,7 @@ class DiffReader else read_or_die end - end while @reader.node_type != 15 # end element + end end read_or_die end diff --git a/test/functional/changeset_controller_test.rb b/test/functional/changeset_controller_test.rb index 4669df07d..b5d65d46d 100644 --- a/test/functional/changeset_controller_test.rb +++ b/test/functional/changeset_controller_test.rb @@ -530,6 +530,24 @@ EOF "shouldn't be able to re-use placeholder IDs" end + ## + # test for more issues in #1568 + def test_upload_empty_invalid + basic_authorization "test@openstreetmap.org", "test" + + [ "", + "", + "", + "" + ].each do |diff| + # upload it + content diff + post :upload, :id => 1 + assert_response(:success, "should be able to upload " + + "empty changeset: " + diff) + end + end + ## # when we make some simple changes we get the same changes back from the # diff download.