Skip to content

Commit 576b702

Browse files
authored
better test clean up (#382)
* better test clean up This makes it so that you don't need to manually delete a bunch of files on test failure. * back to example.com This output is a lot more compact
1 parent bd75237 commit 576b702

File tree

5 files changed

+66
-37
lines changed

5 files changed

+66
-37
lines changed

ci/expect_scripts/file.exp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ expect "Testing some File functions..." {
6464
expect "✓ File.exists! returns true for a file that exists" {
6565
expect "✓ File.exists! returns false for a file that does not exist" {
6666

67-
# Cleanup phase
68-
expect "Cleaning up test files..." {
69-
expect "✓ Deleted all files." {
67+
expect "I ran all file function tests." {
68+
69+
expect "Cleaning up test files..." {
70+
expect "✓ Deleted all files." {
71+
72+
# Final completion message
7073

71-
# Final completion message
72-
expect "I ran all file function tests." {
7374
expect eof {
7475
check_exit_and_segfault
7576
}

ci/expect_scripts/path-test.exp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,23 @@ expect "Testing Path functions..." {
9191
expect "✓ Path.exists! returns true for a file that exists" {
9292
expect "✓ Path.exists! returns false for a file that does not exist" {
9393
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" {
94+
expect "I ran all Path function tests." {
95+
expect "" {
96+
97+
# Cleanup phase
98+
expect "Cleaning up test files..." {
99+
expect "Files to clean up:" {
100+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_bytes\\.txt" {
101+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_hardlink\\.txt" {
102+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_json\\.json" {
103+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_original\\.txt" {
104+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_rename_new\\.txt" {
105+
expect -re "-rw-r--r-- \\d+ \\w+ \\w+ \\d+ \\w+ +\\d+ \\d+:\\d+ test_path_utf8\\.txt" {
106106
expect "" {
107-
108-
# Final completion message
109-
expect "I ran all Path function tests." {
107+
expect "Files remaining after cleanup: Bool.false" {
110108
expect eof {
111-
check_exit_and_segfault
109+
check_exit_and_segfault
110+
}
112111
}
113112
}
114113
}
@@ -121,7 +120,6 @@ expect "Testing Path functions..." {
121120
}
122121
}
123122
}
124-
}
125123
}
126124
}
127125
}

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: "https://github.com",
51+
uri: "https://www.example.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 "https://github.com"
66+
|> &uri "https://www.example.com"
6767
|> &headers [Http.header(("Accept", "text/html"))]
6868
|> Http.send!()?
6969

0 commit comments

Comments
 (0)