-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathpermissions_test.cpp
More file actions
36 lines (29 loc) · 1.32 KB
/
Copy pathpermissions_test.cpp
File metadata and controls
36 lines (29 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <test/utility.hpp>
#include <gtest/gtest.h>
using cmdstan::test::convert_model_path;
using cmdstan::test::run_command;
using cmdstan::test::temporary_unwritable_file;
TEST(interface, fails_when_output_is_unwritable) {
// makes a file without the w bit set
temporary_unwritable_file file(
convert_model_path(std::vector{"test", "output_unwritable.csv"}));
std::string command = convert_model_path(std::vector{
"src", "test", "test-models", "test_model"})
+ " sample output file=" + file.filename;
auto out = run_command(command);
EXPECT_IN_STRING("Permission denied", out.output);
EXPECT_TRUE(out.hasError);
}
TEST(interface, fails_when_output_is_unwritable_multi) {
temporary_unwritable_file file1(
convert_model_path(std::vector{"test", "output_unwritable_1.csv"}));
temporary_unwritable_file file2(
convert_model_path(std::vector{"test", "output_unwritable_2.csv"}));
std::string command = convert_model_path(std::vector{
"src", "test", "test-models", "test_model"})
+ " sample num_chains=2 output file=" + file1.filename
+ "," + file2.filename;
auto out = run_command(command);
EXPECT_IN_STRING("Permission denied", out.output);
EXPECT_TRUE(out.hasError);
}