grim/gplate
Clone
Summary
Browse
Changes
Graph
trying to fix the path problem for templates in the include tests
2012-09-05, Gary Kramlich
613427473cf2
trying to fix the path problem for templates in the include tests
/*
* GPlate - GObject based templating library
* Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<gplate/gplate.h>
static
void
gplate_util_test_quoted_string_helper
(
const
gchar
*
string
,
const
gchar
*
contents
,
gboolean
value
)
{
gboolean
r
=
FALSE
;
gchar
*
c
=
NULL
;
r
=
gplate_util_is_quoted_string
(
string
,
&
c
);
g_assert_cmpint
(
r
,
==
,
value
);
if
(
contents
)
g_assert_cmpstr
(
c
,
==
,
contents
);
g_free
(
c
);
}
static
void
gplate_util_test_quoted_string
(
void
)
{
gplate_util_test_quoted_string_helper
(
"
\"
abc
\"
"
,
"abc"
,
TRUE
);
gplate_util_test_quoted_string_helper
(
"
\"
abc def
\"
"
,
"abc def"
,
TRUE
);
gplate_util_test_quoted_string_helper
(
"
\"
abc
\t
def
\b
ghi
\"
"
,
"abc
\t
def
\b
ghi"
,
TRUE
);
gplate_util_test_quoted_string_helper
(
"abc
\"
def
\"
"
,
NULL
,
FALSE
);
gplate_util_test_quoted_string_helper
(
"
\"
abc
\"
def"
,
NULL
,
FALSE
);
gplate_util_test_quoted_string_helper
(
"'abc'"
,
"abc"
,
TRUE
);
gplate_util_test_quoted_string_helper
(
"'abc def'"
,
"abc def"
,
TRUE
);
gplate_util_test_quoted_string_helper
(
"'abc
\t
def
\b
ghi'"
,
"abc
\t
def
\b
ghi"
,
TRUE
);
gplate_util_test_quoted_string_helper
(
"abc 'def'"
,
NULL
,
FALSE
);
gplate_util_test_quoted_string_helper
(
"'abc' def"
,
NULL
,
FALSE
);
gplate_util_test_quoted_string_helper
(
"'abc
\"
"
,
NULL
,
FALSE
);
gplate_util_test_quoted_string_helper
(
"
\"
abc'"
,
NULL
,
FALSE
);
}
gint
main
(
gint
argc
,
gchar
**
argv
)
{
g_test_init
(
&
argc
,
&
argv
,
NULL
);
g_test_add_func
(
"/util/quoted_string"
,
gplate_util_test_quoted_string
);
return
g_test_run
();
}