Right now we don't test this check very thoroughly, but it might be worthwhile to enumerate all invalid hostnames and ensure that they all raise errors in https://github.com/puppetlabs/puppet/blob/master/spec/unit/parser/ast/leaf_spec.rb#L467