diff options
author | Benjamin Otte <otte@redhat.com> | 2023-03-28 21:09:01 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2023-03-29 03:53:52 +0200 |
commit | 1605b07ff5176cf3b980666617751879ce25a7cc (patch) | |
tree | 4aab6f08763cf045e201d22ec81f0fcb9482ce77 | |
parent | cc9de42e700da733ce32128aadbbc3037ed21ce8 (diff) | |
download | gtk+-1605b07ff5176cf3b980666617751879ce25a7cc.tar.gz |
rendernodeparser: Failing to parse a string is an error
Testcase included.
-rw-r--r-- | gsk/gskrendernodeparser.c | 5 | ||||
-rw-r--r-- | testsuite/gsk/meson.build | 3 | ||||
-rw-r--r-- | testsuite/gsk/nodeparser/string-error.errors | 1 | ||||
-rw-r--r-- | testsuite/gsk/nodeparser/string-error.node | 3 | ||||
-rw-r--r-- | testsuite/gsk/nodeparser/string-error.ref.node | 6 |
5 files changed, 17 insertions, 1 deletions
diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index 6cceafcad7..e377e82d8b 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -416,7 +416,10 @@ parse_string (GtkCssParser *parser, token = gtk_css_parser_get_token (parser); if (!gtk_css_token_is (token, GTK_CSS_TOKEN_STRING)) - return FALSE; + { + gtk_css_parser_error_syntax (parser, "Expected a string"); + return FALSE; + } s = g_strdup (gtk_css_token_get_string (token)); gtk_css_parser_consume_token (parser); diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build index e9abda85d2..0f90f50938 100644 --- a/testsuite/gsk/meson.build +++ b/testsuite/gsk/meson.build @@ -232,6 +232,9 @@ node_parser_tests = [ 'shadow-fail.node', 'shadow-fail.ref.node', 'shadow-fail.errors', + 'string-error.errors', + 'string-error.node', + 'string-error.ref.node', 'testswitch.node', 'text-fail.node', 'text-fail.ref.node', diff --git a/testsuite/gsk/nodeparser/string-error.errors b/testsuite/gsk/nodeparser/string-error.errors new file mode 100644 index 0000000000..47ad1d1e75 --- /dev/null +++ b/testsuite/gsk/nodeparser/string-error.errors @@ -0,0 +1 @@ +<data>:2:12-13: error: GTK_CSS_PARSER_ERROR_SYNTAX diff --git a/testsuite/gsk/nodeparser/string-error.node b/testsuite/gsk/nodeparser/string-error.node new file mode 100644 index 0000000000..6e62f6a6f5 --- /dev/null +++ b/testsuite/gsk/nodeparser/string-error.node @@ -0,0 +1,3 @@ +debug { + message: 5; +} diff --git a/testsuite/gsk/nodeparser/string-error.ref.node b/testsuite/gsk/nodeparser/string-error.ref.node new file mode 100644 index 0000000000..fc7e73a4c7 --- /dev/null +++ b/testsuite/gsk/nodeparser/string-error.ref.node @@ -0,0 +1,6 @@ +debug { + child: color { + bounds: 0 0 50 50; + color: rgb(255,0,204); + } +} |