Issue #3622 has been updated by Hiroshi NAKAMURA.

File expect-continue.diff added

Patch updated with tests. Tests requires current trunk HEAD.
Eric, please try this patch.

RDoc expected. Anyone?
----------------------------------------
http://redmine.ruby-lang.org/issues/show/3622

----------------------------------------
http://redmine.ruby-lang.org
SW5kZXg6IGxpYi9uZXQvaHR0cC5yYgo9PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
Ci0tLSBsaWIvbmV0L2h0dHAucmIJKHJldmlzaW9uIDI5MjE3KQorKysgbGli
L25ldC9odHRwLnJiCSh3b3JraW5nIGNvcHkpCkBAIC01MTcsNiArNTE3LDcg
QEAKICAgICAgIEBzdGFydGVkID0gZmFsc2UKICAgICAgIEBvcGVuX3RpbWVv
dXQgPSBuaWwKICAgICAgIEByZWFkX3RpbWVvdXQgPSA2MAorICAgICAgQGNv
bnRpbnVlX3RpbWVvdXQgPSBuaWwKICAgICAgIEBkZWJ1Z19vdXRwdXQgPSBu
aWwKICAgICAgIEB1c2Vfc3NsID0gZmFsc2UKICAgICAgIEBzc2xfY29udGV4
dCA9IG5pbApAQCAtNTcwLDYgKzU3MSwxNiBAQAogICAgICAgQHJlYWRfdGlt
ZW91dCA9IHNlYwogICAgIGVuZAogCisgICAgIyBTZWNvbmRzIHRvIHdhaXQg
Zm9yIDEwMCBDb250aW51ZSByZXNwb25zZS4gIElmIHRoZSBIVFRQIG9iamVj
dCBkb2VzIG5vdAorICAgICMgcmVjZWl2ZSBhIHJlc3BvbnNlIGluIHRoaXMg
bWFueSBzZWNvbmRzIGl0IHNlbmRzIHRoZSByZXF1ZXN0IGJvZHkuCisgICAg
YXR0cl9yZWFkZXIgOmNvbnRpbnVlX3RpbWVvdXQKKworICAgICMgU2V0dGVy
IGZvciB0aGUgY29udGludWVfdGltZW91dCBhdHRyaWJ1dGUuCisgICAgZGVm
IGNvbnRpbnVlX3RpbWVvdXQ9KHNlYykKKyAgICAgIEBzb2NrZXQu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