fix: write notes and config as LF without BOM on every OS
This commit is contained in:
1 parent
466fef3c23
commit
d77fac61c8
2 files changed
+36
-11
No files matched your search
@@ -51,6 +51,20 @@ class TestOnyxCLI(unittest.TestCase):
|
||||
note_path = self.test_dir / 'test.md'
|
||||
self.assertTrue(note_path.exists())
|
||||
|
||||
def test_writes_keep_lf_without_bom(self):
|
||||
"""Append and frontmatter edits write LF, no BOM, even on Windows"""
|
||||
note_path = self.test_dir / 'lf.md'
|
||||
note_path.write_bytes(b'---\nstatus: draft\n---\n# Journal\n')
|
||||
|
||||
self.cli.create_note('lf.md', '### 10:00 - Entry\nline', append=True)
|
||||
self.cli.frontmatter_edit('lf', ('status',), ('done',))
|
||||
|
||||
data = note_path.read_bytes()
|
||||
self.assertNotIn(b'\r', data)
|
||||
self.assertFalse(data.startswith(b'\xef\xbb\xbf'))
|
||||
self.assertIn(b'status: done', data)
|
||||
self.assertTrue(data.endswith(b'# Journal\n\n### 10:00 - Entry\nline'))
|
||||
|
||||
@unittest.skip("Method export_to_csv not implemented")
|
||||
def test_export_to_csv(self):
|
||||
"""Test exporting note frontmatter to CSV"""
|
||||
|
||||
Reference in new issue
Block a user