From 5e086efce1ae4f8825f6b90c4dc15324d8bea13a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 28 Aug 2016 15:39:18 +0200 Subject: Quiet down dir-iterator test --- tests/dir-iterator/driver.cxx | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/dir-iterator/driver.cxx b/tests/dir-iterator/driver.cxx index 9eebb9f..7e4de84 100644 --- a/tests/dir-iterator/driver.cxx +++ b/tests/dir-iterator/driver.cxx @@ -30,24 +30,34 @@ operator<< (ostream& os, entry_type e) int main (int argc, const char* argv[]) { - if (argc != 2) + if (!(argc == 2 || (argc == 3 && argv[1] == string ("-v")))) { - cerr << "usage: " << argv[0] << " " << endl; + cerr << "usage: " << argv[0] << " [-v] " << endl; return 1; } + bool v (argc == 3); + const char* d (argv[argc - 1]); + try { - for (const dir_entry& de: dir_iterator (dir_path (argv[1]))) + for (const dir_entry& de: dir_iterator (dir_path (d))) { - cerr << de.ltype () << " "; + entry_type lt (de.ltype ()); + entry_type t (lt == entry_type::symlink ? de.ltype () : lt); + const path& p (de.path ()); + + if (v) + { + cerr << lt << " "; - if (de.ltype () == entry_type::symlink) - cerr << de.type (); - else - cerr << " "; + if (lt == entry_type::symlink) + cerr << t; + else + cerr << " "; - cerr << " " << de.path () << endl; + cerr << " " << p << endl; + } } } catch (const exception& e) -- cgit v1.1