Backport test coverage from aosp/1547496.
This test coverage is necessary to fix an upcoming bug in R.
Backport it from the change that added it. The non-test portion
of that change is not necessary in R because it fixes a
bug that was introduced in S.
Test: accompanying unit test shows lots of bugs removed
(cherry picked from commit 55229beb747b9e7b8a0f392d855a1b3342df8646)
1 file changed