From 143d2f473fb92256d33f91266aa9d1829bc9fce1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 30 Jul 2018 13:02:13 +0300 Subject: Add test for project_name::base() --- tests/project-name/driver.cxx | 9 ++++++--- tests/project-name/testscript | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/project-name/driver.cxx b/tests/project-name/driver.cxx index 51c8782..3535ba2 100644 --- a/tests/project-name/driver.cxx +++ b/tests/project-name/driver.cxx @@ -45,7 +45,7 @@ name (const string& s) return r; } -// Usage: argv[0] (string|base|extension|variable) +// Usage: argv[0] (string|base [ext]|extension|variable) // // Create project names from stdin lines, and for each of them print the // result of the specified member function to stdout, one per line. @@ -54,21 +54,24 @@ int main (int argc, char* argv[]) try { - assert (argc == 2); + assert (argc <= 3); string m (argv[1]); assert (m == "string" || m == "base" || m == "extension" || m == "variable"); + assert (m == "base" ? argc <= 3 : argc == 2); cin.exceptions (ios::badbit); cout.exceptions (ios::failbit | ios::badbit); + const char* ext (argc == 3 ? argv[2] : nullptr); + string l; while (!eof (getline (cin, l))) { project_name n (name (l)); const string& s (m == "string" ? n.string () : - m == "base" ? n.base () : + m == "base" ? n.base (ext) : m == "extension" ? n.extension () : n.variable ()); diff --git a/tests/project-name/testscript b/tests/project-name/testscript index 92bd5e8..78d02c0 100644 --- a/tests/project-name/testscript +++ b/tests/project-name/testscript @@ -32,8 +32,10 @@ : base : { - test.arguments += 'base'; + test.arguments += 'base' + : no-ext + : $* <>EOO libbutl libbutl.bash @@ -43,6 +45,22 @@ libbutl a.b EOO + + : ext + : + { + test.arguments += bash; + + $* <>EOO + libbutl + libbutl.bash + libbutl.python + EOI + libbutl + libbutl + libbutl.python + EOO + } } : extension -- cgit v1.1