Australia had something similar to implement its "White Australia" policy. Apparently, British authorities objected to explicitly racist rules. So the scheme they came up with was that the border officials could, at their discretion, ask somebody coming into the country to pass a dictation test to prove their literacy. The test could be administered in
any European language. Very few people managed to pass. Details:
https://www.nma.gov.au/defining-moments/resources/white-aust...