#include <deal.II/base/parameter_handler.h>
#include <fstream>
+// header for chdir is platform dependent; when the day comes that we support
+// Windows in the test suite then conditionally include direction.h
+#include <unistd.h>
+
/*
* Test that ParameterHandler does not join lines for things like
*
Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")));
prm.leave_subsection ();
+ // We need a local path for the file to get consistent output messages.
+ const int chdir_return_code = chdir (SOURCE_DIR);
+ AssertThrow (chdir_return_code == 0, ExcInternalError());
// test both relevant read_input functions. They should fail with a
// specific exception.
try
{
if (i == 0)
{
- prm.read_input(SOURCE_DIR "/prm/parameter_handler_backslash_03.prm");
+ prm.read_input("prm/parameter_handler_backslash_03.prm");
}
else
{
std::ifstream input_stream
- (SOURCE_DIR "/prm/parameter_handler_backslash_03.prm");
+ ("prm/parameter_handler_backslash_03.prm");
prm.read_input(input_stream);
}
DEAL::ExcInvalidEntryForPattern (current_line_n, input_filename, entry_value, entry_name, patterns[pattern_index]->description())
-Line <4> of file <./prm/parameter_handler_backslash_03.prm>:
+Line <4> of file <prm/parameter_handler_backslash_03.prm>:
The entry value
a,\
for the entry named
Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")));
prm.leave_subsection ();
+ // We need a local path for the file to get consistent output messages.
+ const int chdir_return_code = chdir (SOURCE_DIR);
+ AssertThrow (chdir_return_code == 0, ExcInternalError());
// test both relevant read_input functions. They should fail with a
// specific exception.
try
{
if (i == 0)
{
- prm.read_input(SOURCE_DIR "/prm/parameter_handler_backslash_04.prm");
+ prm.read_input("prm/parameter_handler_backslash_04.prm");
}
else
{
std::ifstream input_stream
- (SOURCE_DIR "/prm/parameter_handler_backslash_04.prm");
+ ("prm/parameter_handler_backslash_04.prm");
prm.read_input(input_stream);
}
DEAL::ExcInvalidEntryForPattern (current_line_n, input_filename, entry_value, entry_name, patterns[pattern_index]->description())
-Line <4> of file <./prm/parameter_handler_backslash_04.prm>:
+Line <4> of file <prm/parameter_handler_backslash_04.prm>:
The entry value
a,\ b,
for the entry named
prm.leave_subsection ();
+ // We need a local path for the file to get consistent output messages.
+ const int chdir_return_code = chdir (SOURCE_DIR);
+ AssertThrow (chdir_return_code == 0, ExcInternalError());
// test both relevant read_input functions
try
{
if (i == 0)
{
- prm.read_input(SOURCE_DIR "/prm/parameter_handler_backslash_05.prm");
+ prm.read_input("prm/parameter_handler_backslash_05.prm");
}
else
{
std::ifstream input_stream
- (SOURCE_DIR "/prm/parameter_handler_backslash_05.prm");
+ ("prm/parameter_handler_backslash_05.prm");
prm.read_input(input_stream);
}
DEAL::ExcCannotParseLine (current_line_n, input_filename, "The line\n\n" " <" + original_line + ">\n\n" "could not be parsed: please check to " "make sure that the file is not missing a " "'set', 'include', 'subsection', or 'end' " "statement.")
-Line <8> of file <./prm/parameter_handler_backslash_05.prm>: The line
+Line <8> of file <prm/parameter_handler_backslash_05.prm>: The line
<b, c>