tests: Add GTK directive error tests

This commit is contained in:
James Westman 2022-03-28 14:18:17 -05:00
parent f197e68589
commit 4cf966eafa
7 changed files with 11 additions and 4 deletions

View file

@ -34,14 +34,17 @@ class GtkDirective(AstNode):
if self.tokens["version"] not in ["4.0"]:
err = CompileError("Only GTK 4 is supported")
if self.tokens["version"].startswith("4"):
err.hint("Expected the GIR version, not an exact version number. Use `using Gtk 4.0;`.")
err.hint("Expected the GIR version, not an exact version number. Use 'using Gtk 4.0;'.")
else:
err.hint("Expected `using Gtk 4.0;`")
err.hint("Expected 'using Gtk 4.0;'")
raise err
@property
def gir_namespace(self):
# validate the GTK version first to make sure the more specific error
# message is emitted
self.gtk_version()
return gir.get_namespace("Gtk", self.tokens["version"])