{
"id": "fn-test-file_contents_equal",
"dataComponent": "test",
"heading": {
"title": "file_contents_equal",
"badges": [
"Testing",
"Assert"
]
},
"synopsis": "Fails the current test if a file's contents differ from an expected string, or if the file cannot be read.",
"codeBlocks": [
"extend(\"test\")\n\n# Basic usage:\nfile_contents_equal(\"/tmp/myfile.txt\", \"Hello, world!\")\n# => passes if /tmp/myfile.txt exactly matches \"Hello, world!\"\n\n# If it differs, the test fails with a 'file_contents_equal fail' message.\n\n# If the file cannot be read or doesn't exist, the test also fails.\n"
],
"notes": [
"Expects exactly 2 arguments: (filename, expectedString).",
"If the file contents differ or the file can't be read, it immediately fails the test (e.g., 'file_contents_equal fail').",
"Part of the 'file_asserts' bridging in the test plugin, primarily used in test code."
]
}