foundry-rs / foundry-rs/foundry
feat(cheatcodes): `vm.writeToml` should keep original formatting including comments
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 18h 20m
- Merged PRs (30d)
- 510
Description
### Component
Forge
### Describe the feature you would like
### Current behavior
Toml file:
```toml
key1 = "1"
# this is key2
key2 = "2"
```
Script:
```solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.24;
import {Script, console} from "forge-std/Script.sol";
contract TomlTest is Script {
function run() public {
vm.writeToml("abcd", "test.toml", ".key2");
}
}
```
Resulting toml file, after running `forge script scripts/foundry/TomlTest.s.sol:TomlTest`:
```toml
key1 = "1"
key2 = "abcd"
```
### Desired behavior
`writeToml` should maintain the original formatting (line breaks, comments):
```toml
key1 = "1"
# this is key2
key2 = "abcd"
```
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.