diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2011-09-12 22:40:51 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2011-09-12 22:40:51 (GMT) |
commit | f5f06c8e976ca45aebea42fe8c04bf7404357ac8 (patch) | |
tree | 8d0cdd2698e7806c1b12cc49e743b561e1082961 /tests/dumptest.cc | |
parent | 007c40848db9efd704694f2e7596cabed80da50f (diff) | |
parent | 5ac9162f1c67fd21737ead11d7ebc638bf4eef5f (diff) |
merge
Merge remote branch 'upstream/visitor' into visitortests
Conflicts:
src/export.cc
src/openscad.cc
src/polyset.cc
src/transform.cc
tests/CMakeLists.txt
tests/FindGLEW.cmake
tests/csgtermtest.cc
Diffstat (limited to 'tests/dumptest.cc')
-rw-r--r-- | tests/dumptest.cc | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 3f6068a..65424b3 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -25,6 +25,7 @@ */ #include "openscad.h" +#include "handle_dep.h" #include "node.h" #include "module.h" #include "context.h" @@ -41,29 +42,15 @@ #include <getopt.h> #include <assert.h> #include <iostream> +#include <sstream> using std::string; -QString commandline_commands; -const char *make_command = NULL; -QSet<QString> dependencies; +std::string commandline_commands; QString currentdir; QString examplesdir; QString librarydir; -void handle_dep(QString filename) -{ - if (filename.startsWith("/")) - dependencies.insert(filename); - else - dependencies.insert(QDir::currentPath() + QString("/") + filename); - if (!QFile(filename).exists() && make_command) { - char buffer[4096]; - snprintf(buffer, 4096, "%s '%s'", make_command, filename.replace("'", "'\\''").toUtf8().data()); - system(buffer); // FIXME: Handle error - } -} - int main(int argc, char **argv) { if (argc != 2) { @@ -130,15 +117,16 @@ int main(int argc, char **argv) fprintf(stderr, "Can't open input file `%s'!\n", filename); exit(1); } else { - QString text; + std::stringstream text; char buffer[513]; int ret; while ((ret = fread(buffer, 1, 512, fp)) > 0) { buffer[ret] = 0; - text += buffer; + text << buffer; } fclose(fp); - root_module = parse((text+commandline_commands).toAscii().data(), fileInfo.absolutePath().toLocal8Bit(), false); + text << commandline_commands; + root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); if (!root_module) { exit(1); } @@ -156,7 +144,7 @@ int main(int argc, char **argv) string dumpstdstr = tree.getString(*root_node); string dumpstdstr_cached = tree.getString(*root_node); - if (dumpstdstr != dumpstdstr_cached) rc = 1; + assert(dumpstdstr == dumpstdstr_cached); std::cout << dumpstdstr << "\n"; |