| 79 | using namespace proton; |
| 80 | |
| 81 | void test_default_file() { |
| 82 | // Default file locations in order of preference. |
| 83 | ::setenv("MESSAGING_CONNECT_FILE", "environment", 1); |
| 84 | ofstream("connect.json") << R"({ "host": "current" })" << endl; |
| 85 | ::setenv("HOME", "testdata", 1); |
| 86 | ofstream("testdata/.config/messaging/connect.json") << R"({ "host": ".config" })" << endl; |
| 87 | ASSERT_EQUAL("environment", connect_config::default_file()); |
| 88 | ::unsetenv("MESSAGING_CONNECT_FILE"); |
| 89 | ASSERT_EQUAL("connect.json", connect_config::default_file()); |
| 90 | remove("connect.json"); |
| 91 | ASSERT_EQUAL("testdata/.config/messaging/connect.json", connect_config::default_file()); |
| 92 | remove("testdata/.config/messaging/connect.json"); |
| 93 | |
| 94 | // We can't fully test prefix and /etc locations, we have no control. |
| 95 | try { |
| 96 | ASSERT_SUBSTRING("/etc/messaging", connect_config::default_file()); |
| 97 | } catch (...) {} // OK if not there |
| 98 | } |
| 99 | |
| 100 | void test_addr() { |
| 101 | connection_options opts; |
no test coverage detected