Wilfred Hughes on Nostr: Rust has an elegant solution to testing private functions: you put the test in the ...
Rust has an elegant solution to testing private functions: you put the test in the file that defines the function. It generally works well.
I've even seen people argue that it makes mocking much less necessary! I've not felt the need to mock in Rust so far.
Published at
2023-06-04 05:53:58Event JSON
{
"id": "d756d2095846d49562591ee016464b98bb33daf3cb8de24fd20acb5c72380259",
"pubkey": "27c7ddcdba1d8cc847191c23aa2bf54f085cdedb6a6d7e5e460e6c8b59798786",
"created_at": 1685858038,
"kind": 1,
"tags": [
[
"mostr",
"https://mastodon.social/users/wilfredh/statuses/110484392413963804"
]
],
"content": "Rust has an elegant solution to testing private functions: you put the test in the file that defines the function. It generally works well.\n\nI've even seen people argue that it makes mocking much less necessary! I've not felt the need to mock in Rust so far.",
"sig": "cfdf08496e3cd4937e75336f1910721bea9633c1972e797ce45866df2fc63fe8b9c5eafb3749cf1963e671a6b67a9262a72a7030292aa56ef7e5b0f5c80e05f3"
}