Skip to content

Commit 6e65b5f

Browse files
authored
Add Path.exists! (#381)
1 parent c610e58 commit 6e65b5f

4 files changed

Lines changed: 72 additions & 19 deletions

File tree

ci/expect_scripts/path-test.exp

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,35 @@ expect "Testing Path functions..." {
8484
expect "✓ Original file no longer exists" {
8585
expect "✓ Renamed file exists" {
8686
expect "✓ Renamed file has correct content" {
87-
expect "" {
88-
# Cleanup phase
89-
expect "Cleaning up test files..." {
90-
expect "Files to clean up:" {
91-
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_bytes\\.txt" {
92-
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_hardlink\\.txt" {
93-
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_json\\.json" {
94-
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_original\\.txt" {
95-
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_utf8\\.txt" {
96-
expect "" {
97-
expect "Files remaining after cleanup: Bool.false" {
98-
expect "" {
99-
100-
# Final completion message
101-
expect "I ran all Path function tests." {
102-
expect eof {
103-
check_exit_and_segfault
87+
expect "" {
88+
89+
# Test Path.exists!
90+
expect "Testing Path.exists!:" {
91+
expect "✓ Path.exists! returns true for a file that exists" {
92+
expect "✓ Path.exists! returns false for a file that does not exist" {
93+
expect "" {
94+
95+
# Cleanup phase
96+
expect "Cleaning up test files..." {
97+
expect "Files to clean up:" {
98+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_bytes\\.txt" {
99+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_hardlink\\.txt" {
100+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_json\\.json" {
101+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_original\\.txt" {
102+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_rename_new\\.txt" {
103+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_utf8\\.txt" {
104+
expect "" {
105+
expect "Files remaining after cleanup: Bool.false" {
106+
expect "" {
107+
108+
# Final completion message
109+
expect "I ran all Path function tests." {
110+
expect eof {
111+
check_exit_and_segfault
112+
}
113+
}
114+
}
115+
}
104116
}
105117
}
106118
}
@@ -114,6 +126,7 @@ expect "Testing Path functions..." {
114126
}
115127
}
116128
}
129+
}
117130
}
118131
}
119132
}

examples/http.roc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ main! = |_args|
4848
{
4949
method: GET,
5050
headers: [],
51-
uri: "http://www.example.com",
51+
uri: "https://github.com",
5252
body: [],
5353
timeout_ms: TimeoutMilliseconds(5000),
5454
},
@@ -63,7 +63,7 @@ main! = |_args|
6363
6464
response_2 =
6565
Http.default_request
66-
|> &uri "http://www.example.com"
66+
|> &uri "https://github.com"
6767
|> &headers [Http.header(("Accept", "text/html"))]
6868
|> Http.send!()?
6969

0 commit comments

Comments
 (0)