hoodquidity/packages/contracts/lib/forge-std/test/StdToml.t.sol
Денис Зефиров dba2811447 Hoodquidity: liquidity campaigns for Robinhood Chain stock token markets
Full build: Vite/React acid-terminal frontend (BEARER design system,
Panchang/Sentient/Fragment Mono, neon layer, palette audit script),
HoodquidityVaults Foundry contracts (single+dual deposits via Chainlink-style
feeds, hybrid exit, 10% platform fee, boost, Genesis LP), Reown AppKit wallet
connect with Robinhood Chain testnet (46630), live data from Dexscreener and
onchain reads, partner portal, design-sync setup for claude.ai/design.

Deploy: static via Forgejo Actions platform, BUILD_DIR=apps/web/dist (.env).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 08:32:28 +04:00

49 lines
1.3 KiB
Solidity

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.13 <0.9.0;
import {Test, stdToml} from "../src/Test.sol";
contract StdTomlTest is Test {
using stdToml for string;
string root;
string path;
function setUp() public {
root = vm.projectRoot();
path = string.concat(root, "/test/fixtures/test.toml");
}
struct SimpleToml {
uint256 a;
string b;
}
struct NestedToml {
uint256 a;
string b;
SimpleToml c;
}
function test_readToml() public view {
string memory json = vm.readFile(path);
assertEq(json.readUint(".a"), 123);
}
function test_writeToml() public {
string memory json = "json";
json.serialize("a", uint256(123));
string memory semiFinal = json.serialize("b", string("test"));
string memory finalJson = json.serialize("c", semiFinal);
finalJson.write(path);
string memory toml = vm.readFile(path);
bytes memory data = toml.parseRaw("$");
NestedToml memory decodedData = abi.decode(data, (NestedToml));
assertEq(decodedData.a, 123);
assertEq(decodedData.b, "test");
assertEq(decodedData.c.a, 123);
assertEq(decodedData.c.b, "test");
}
}