aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2025-02-03 12:54:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2025-02-03 12:54:10 +0200
commit58b796368082251c639bf13a66148d4941ff46cf (patch)
tree877d28446412c867512719641cf597d682812092 /tests
parenta78a985bb6aa02227ce9e5833a25af37ae9a3e86 (diff)
Redo operator<<(process_env) to print process pathHEADmaster
Also provide to_stream() that can print any subset of information. The old semantics did not work well for function templates that tried to print process_path or process_env generically. More generally, only printing a subset of data by default is surprising.
Diffstat (limited to 'tests')
-rw-r--r--tests/process/driver.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/process/driver.cxx b/tests/process/driver.cxx
index 1ee5710..4fef2e0 100644
--- a/tests/process/driver.cxx
+++ b/tests/process/driver.cxx
@@ -500,31 +500,31 @@ main (int argc, const char* argv[])
auto str = [] (const process_env& env)
{
ostringstream os;
- os << env;
+ to_stream (os, env);
return os.str ();
};
- process_path p;
+ process_path p (path ("program"));
- assert (str (process_env (p)) == "");
+ assert (str (process_env (p)) == "program");
{
dir_path d ("dir");
dir_path ds ("d ir");
- assert (str (process_env (p, d)) == "PWD=dir");
- assert (str (process_env (p, ds)) == "PWD=\"d ir\"");
+ assert (str (process_env (p, d)) == "PWD=dir program");
+ assert (str (process_env (p, ds)) == "PWD=\"d ir\" program");
}
{
dir_path ed; // Empty.
const char* vars[] = {nullptr};
- assert (str (process_env (p, ed, vars)) == "");
+ assert (str (process_env (p, ed, vars)) == "program");
}
{
const char* vars[] = {"A=B", "A=B C", "A B=C", "A", "A B", nullptr};
assert (str (process_env (p, vars)) ==
- "A=B A=\"B C\" \"A B=C\" A= \"A B=\"");
+ "A=B A=\"B C\" \"A B=C\" A= \"A B=\" program");
}
}
}