api: add writer_test with one test case.