mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
tests: Add GTK directive error tests
This commit is contained in:
parent
f197e68589
commit
4cf966eafa
7 changed files with 11 additions and 4 deletions
|
@ -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"])
|
||||
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@ class UI(AstNode):
|
|||
try:
|
||||
gir_ctx.add_namespace(self.children[GtkDirective][0].gir_namespace)
|
||||
except CompileError as e:
|
||||
e.start = self.children[GtkDirective][0].group.start
|
||||
e.end = self.children[GtkDirective][0].group.end
|
||||
self._gir_errors.append(e)
|
||||
|
||||
for i in self.children[Import]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue