summaryrefslogtreecommitdiff
path: root/test/execute_test.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2024-10-02 21:20:40 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2024-10-02 22:02:51 +0200
commit0d13088ab99cf7d981932451d65034595949ebf8 (patch)
treec3e89b948afe2ac3191833d94c971a4456ccc1a1 /test/execute_test.cc
parenta38c6682e4fb1f45aa1f37d10c2480aa517ea3bc (diff)
Ensure the initial task order is preserved. Fixes bad ordering during linking.
Diffstat (limited to 'test/execute_test.cc')
-rw-r--r--test/execute_test.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/execute_test.cc b/test/execute_test.cc
index 03b3c2a..d5d40c9 100644
--- a/test/execute_test.cc
+++ b/test/execute_test.cc
@@ -2,10 +2,11 @@
#include <fstream>
#include <map>
-#include <set>
+#include <vector>
#include <execute.h>
#include <util.h>
+#include <algorithm>
#include "paths.h"
#include "tmpfile.h"
@@ -34,6 +35,8 @@ public:
void env()
{
+ using namespace std::string_literals;
+
auto cur_path = std::filesystem::path(paths::argv_0).parent_path();
std::vector<std::string> paths{{cur_path.string()}};
auto cmd = locate("testprog", paths);
@@ -52,22 +55,25 @@ public:
uASSERT_EQUAL(0, execute(cmd, {"envdump", tmp.get()}, env, false));
- std::set<std::string> vars;
+ std::vector<std::string> vars;
{
std::ifstream infile(tmp.get());
std::string line;
while (std::getline(infile, line))
{
- vars.insert(line);
+ vars.push_back(line);
}
}
// Check the two explicitly set vars
- uASSERT(vars.find("foo=bar") != vars.end());
- uASSERT(vars.find("bar=42") != vars.end());
+ auto chk = std::find(vars.begin(), vars.end(), "foo=bar"s);
+ uASSERT(chk != vars.end());
+ chk = std::find(vars.begin(), vars.end(), "bar=42"s);
+ uASSERT(chk != vars.end());
// Check the one that should have overwritten the existing one (probably LANG=en_US.UTF-8 or something)
- uASSERT(vars.find("LANG=foo") != vars.end());
+ chk = std::find(vars.begin(), vars.end(), "LANG=foo"s);
+ uASSERT(chk != vars.end());
// Check that other vars are also there (ie. the env wasn't cleared on entry)
uASSERT(vars.size() > 3);