whitequark/parser — pull request #102 by JoshCheek (2013-08-06 17:25:40+00:00)
Title: Source::Rewriter applies insertions at same location in insertion order

Since Ruby sorting isn't stable, insertions at the same location can get ordered arbitrarily. This stabilizes the sorting.

For reference, here was the failure (because the ordering is arbitrary, I don't know that it's guaranteed to be reproducible)

```
$ ruby -I test test/test_source_rewriter.rb
Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
From:
/Users/joshcheek/.rbenv/versions/1.9.3-p327-perf/lib/ruby/1.9.1/minitest/autorun.rb:14:in `'
/Users/joshcheek/code/foss/parser/test/helper.rb:42:in `'
test/test_source_rewriter.rb:1:in `

'
MiniTest::Unit.autorun is now Minitest.autorun. From /Users/joshcheek/.rbenv/versions/1.9.3-p327-perf/lib/ruby/1.9.1/minitest/autorun.rb:18:in `'
Run options: --seed 59361

# Running:

..F.....

Finished in 0.012682s, 630.8153 runs/s, 1103.9268 assertions/s.

1) Failure:
TestSourceRewriter#test_multiple_insertions_at_same_location [test/test_source_rewriter.rb:60]:
Expected: "<([foo] bar) baz>"
Actual: "<[(foo] bar) baz>"

8 runs, 14 assertions, 1 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /Users/joshcheek/code/foss/parser/coverage. 635 / 1354 LOC (46.9%) covered.
Coverage report generated for Unit Tests to /Users/joshcheek/code/foss/parser/coverage/sublime-ruby-coverage
[Coveralls] Outside the Travis environment, not sending data.
```