Writing Tests in Rust with Laguna

Writing Tests in Rust with Laguna 图片 1

Tests are important for ensuring code quality, and are even more important for programming in the age of LLMs. I have been using Laguna XS 2.1 with OpenCode to improve my test cases. Rust has native support for tests with "cargo test", so there are no excuses for skipping unit tests.

Writing Tests

With AI agents, I have noticed they tend to create unit tests for functions they add. But sometimes these tests seem too narrowly-focused: they test a specific function, but we could use a more general test.

I had Laguna XS remove most of the tests in my Rust project, and added a new, more general test instead. The new test covers many functions at once. So I have fewer tests, but more coverage of the code, which seems to me a win.

I probably wouldn't have bothered doing this boring work if it were not for agentic AI. But overall, having the general tests is cleaner, less maintenance, and ensures higher quality—and I only had to do part of the work myself, as Laguna XS helped out.

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论