@@ -68,3 +68,51 @@ def test_run_csv_view_short_rows_are_padded(tmp_path: Path) -> None:
6868 assert "3" in output
6969 # There should be at least one empty/padded cell visible in output
7070 assert " " in output
71+
72+
73+ @pytest .mark .skipif (sys .platform == "win32" , reason = "POSIX temp paths are used for this regression test" )
74+ def test_run_csv_view_handles_unquoted_paths_with_spaces (tmp_path : Path ) -> None :
75+ from trushell .commands .data import run_csv_view
76+
77+ directory = tmp_path / "Program Files"
78+ directory .mkdir ()
79+ file_path = directory / "users.csv"
80+ file_path .write_text ("ID,Name\n 1,Ada\n " , encoding = "utf-8" )
81+
82+ output = _strip_ansi (run_csv_view (str (file_path )))
83+
84+ assert "ID" in output
85+ assert "Name" in output
86+ assert "Ada" in output
87+
88+
89+ @pytest .mark .skipif (sys .platform != "win32" , reason = "Windows path parsing regression" )
90+ def test_run_csv_view_handles_unquoted_windows_paths (tmp_path : Path ) -> None :
91+ from trushell .commands .data import run_csv_view
92+
93+ file_path = tmp_path / "users.csv"
94+ rows = ["ID,Name" ] + [f"{ i } ,User { i } " for i in range (1 , 52 )]
95+ file_path .write_text ("\n " .join (rows ), encoding = "utf-8" )
96+
97+ output = _strip_ansi (run_csv_view (str (file_path )))
98+
99+ assert "User 50" in output
100+ assert "User 51" not in output
101+ assert "...and 1 more" in output
102+ assert "rows" in output
103+
104+
105+ @pytest .mark .skipif (sys .platform != "win32" , reason = "Windows path with spaces regression" )
106+ def test_run_csv_view_handles_windows_paths_with_spaces (tmp_path : Path ) -> None :
107+ from trushell .commands .data import run_csv_view
108+
109+ directory = tmp_path / "Program Files"
110+ directory .mkdir ()
111+ file_path = directory / "users.csv"
112+ file_path .write_text ("ID,Name\n 1,Ada\n " , encoding = "utf-8" )
113+
114+ output = _strip_ansi (run_csv_view (str (file_path )))
115+
116+ assert "ID" in output
117+ assert "Name" in output
118+ assert "Ada" in output
0 commit comments