Skip to content

Commit

Permalink
feat: add examples for new fs cheatcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruvaag committed Aug 30, 2023
1 parent ba26f4c commit 3efd7b0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/cheatcodes/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,24 @@ string memory data = "hello world";
vm.writeFile(path, data);
assertEq(vm.readFile(path), data);
```

Verify that a filesystem path is valid

```solidity
// Verify that the path 'foo/files/bar.txt' exists
string memory validPath = "foo/files/bar.txt";
assertTrue(vm.isFile(validFilePath));
```

Verify that a filesystem path points to a file or directory

```solidity
// Verify that path 'foo/file/bar.txt' points to a file
string memory validFilePath = "foo/files/bar.txt";
assertTrue(vm.isFile(validFilePath));
// Verify that 'foo/file' points to a directory
string memory validDirPath = "foo/files";
assertTrue(vm.isDir(validDirPath));
```

0 comments on commit 3efd7b0

Please sign in to comment.