Merge commit '3d83740f88b6aaba6962256be517656496b83f25' into lsp-server
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from scripts import playbook
|
||||
|
||||
@@ -18,6 +20,44 @@ key = 1
|
||||
with self.assertRaises(ValueError):
|
||||
playbook.loads_toml_minimal(raw)
|
||||
|
||||
def test_load_config_preserves_windows_users_path_in_basic_string(self):
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
config_path = Path(tmp_dir) / "playbook.toml"
|
||||
config_path.write_text(
|
||||
'[playbook]\nproject_root = "C:\\Users\\demo\\workspace"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
data = playbook.load_config(config_path)
|
||||
|
||||
self.assertEqual(data["playbook"]["project_root"], r"C:\Users\demo\workspace")
|
||||
|
||||
def test_load_config_preserves_windows_escape_like_segments_for_path_keys(self):
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
config_path = Path(tmp_dir) / "playbook.toml"
|
||||
config_path.write_text(
|
||||
'[playbook]\nproject_root = "C:\\tmp\\notes"\n\n'
|
||||
'[install_skills]\nagents_home = "D:\\new\\tab"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
data = playbook.load_config(config_path)
|
||||
|
||||
self.assertEqual(data["playbook"]["project_root"], r"C:\tmp\notes")
|
||||
self.assertEqual(data["install_skills"]["agents_home"], r"D:\new\tab")
|
||||
|
||||
def test_load_config_keeps_already_escaped_windows_path(self):
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
config_path = Path(tmp_dir) / "playbook.toml"
|
||||
config_path.write_text(
|
||||
'[playbook]\nproject_root = "C:\\\\Users\\\\demo\\\\workspace"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
data = playbook.load_config(config_path)
|
||||
|
||||
self.assertEqual(data["playbook"]["project_root"], r"C:\Users\demo\workspace")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user