Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
glom
Commits
34d506f7
Unverified
Commit
34d506f7
authored
Jun 19, 2017
by
Murray Cumming
Browse files
Don't return boolean literal from main().
Noticed by a g++ warning.
parent
472055c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/test_document_load.cc
View file @
34d506f7
...
...
@@ -262,7 +262,7 @@ int main()
if
(
!
module_names
.
empty
())
//TODO: Test a document that actually has some?
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Unexpected library module names.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
...
...
@@ -272,32 +272,32 @@ int main()
if
(
print_layout_names
.
size
()
!=
1
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Unexpected number of print layouts.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
!
contains
(
print_layout_names
,
"contact_details"
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Could not find the expected print layout name.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
const
auto
print_layout
=
document
->
get_print_layout
(
"contacts"
,
"contact_details"
);
if
(
!
print_layout
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Could not get an expected print layout.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
print_layout
->
get_title_original
()
!=
"Contact Details"
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Unexpected print layout title.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
!
print_layout
->
get_layout_group
())
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The print layout has no layout group.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
...
...
@@ -306,32 +306,32 @@ int main()
if
(
report_names
.
size
()
!=
2
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Unexpected number of reports.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
!
contains
(
report_names
,
"by_country"
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Could not find the expected report name.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
const
auto
report
=
document
->
get_report
(
"contacts"
,
"by_country_by_town"
);
if
(
!
report
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Could not get an expected report.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
report
->
get_title_original
()
!=
"By Country, By Town"
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Unexpected report title.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
!
report
->
get_layout_group
())
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The report has no layout group.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
...
...
@@ -356,13 +356,13 @@ int main()
if
(
!
needs_navigation
(
document
,
"scenes"
,
"location_id"
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: DbUtils::layout_field_should_have_navigation() did not return the expected result.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
needs_navigation
(
document
,
"scenes"
,
"description"
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: DbUtils::layout_field_should_have_navigation() did not return the expected result.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
...
...
@@ -375,7 +375,7 @@ int main()
if
(
!
portal
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Could not get the portal from the layout.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
Glib
::
ustring
navigation_table_name
;
...
...
@@ -385,19 +385,19 @@ int main()
if
(
navigation_table_name
!=
"characters"
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: get_suitable_table_to_view_details() returned an unexpected table name: "
<<
navigation_table_name
<<
std
::
endl
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
!
navigation_relationship
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: get_suitable_table_to_view_details() returned an empty navigation_relationship.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
navigation_relationship
->
get_relationship_name
()
!=
"cast"
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: get_suitable_table_to_view_details() returned an unexpected navigation_relationship name: "
<<
navigation_relationship
->
get_relationship_name
()
<<
std
::
endl
;
return
false
;
return
EXIT_FAILURE
;
}
Glom
::
libglom_deinit
();
...
...
tests/test_document_load_and_change.cc
View file @
34d506f7
...
...
@@ -105,14 +105,14 @@ int main()
if
(
document
->
get_field
(
table_name
,
field_name_original
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The document should have forgotten about the original field name.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
//Check that the new field name is known to the document:
if
(
!
(
document
->
get_field
(
table_name
,
field_name_new
)))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The document does not know about the new field name.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
//Check that the original field name is no longer used in the relationship:
...
...
@@ -120,20 +120,20 @@ int main()
if
(
!
relationship
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The relationship could not be found in the document.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
relationship
->
get_to_field
()
==
field_name_original
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The relationship still uses the original field name.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
//Check that the original field name is no longer used on a layout:
if
(
field_is_on_a_layout
(
document
,
table_name
,
field_name_original
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The original field name is still used on a layout.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
{
...
...
@@ -146,13 +146,13 @@ int main()
if
(
document
->
get_relationship
(
table_name
,
relationship_name_original
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The original relationship name still exists.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
!
document
->
get_relationship
(
table_name
,
relationship_name_new
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The new relationship name does not exist.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
//Check that the old relationship name is not used.
...
...
@@ -162,7 +162,7 @@ int main()
if
(
field_on_layout
->
get_relationship_name
()
!=
relationship_name_new
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: A layout item does not use the new relationship name as expected.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
}
...
...
@@ -171,7 +171,7 @@ int main()
if
(
field_is_on_a_layout
(
document
,
"publisher"
,
"publisher_id"
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The removed field name is still used on a layout.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
//Remove a relationship:
...
...
@@ -180,7 +180,7 @@ int main()
if
(
relationship
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The removed relationship still exists.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
//Change a table name:
...
...
@@ -189,27 +189,27 @@ int main()
if
(
document
->
get_table
(
"invoice_lines"
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The renamed table still exists.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
relationship
=
document
->
get_relationship
(
"invoices"
,
"invoice_lines"
);
if
(
!
relationship
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The expected relationship does not exist.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
if
(
relationship
->
get_to_table
()
!=
table_renamed
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The relationship's to_table does have been renamed.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
document
->
remove_table
(
"products"
);
if
(
document
->
get_table
(
"products"
))
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The removed table still exists.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
...
...
@@ -219,7 +219,7 @@ int main()
if
(
!
print_layout
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: Could not get an expected print layout.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
document
->
remove_print_layout
(
"contacts"
,
"contact_details"
);
...
...
@@ -228,7 +228,7 @@ int main()
if
(
print_layout
)
{
std
::
cerr
<<
G_STRFUNC
<<
": Failure: The removed print layotu still exists.
\n
"
;
return
false
;
return
EXIT_FAILURE
;
}
//Test user groups:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment