fix #315 autocomplete issue - improved test case

This improves the test case pushed in
5dc63fd637810862291ce5e31a6688dac4556487. Under some circumstances, the
old test may fail.