File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ path = ".."
1212
1313[compat ]
1414Aqua = " 0.8"
15- ITensorFormatter = " 0.2"
15+ ITensorFormatter = " 0.2, 0.3 "
1616ITensorPkgSkeleton = " 0.3.42"
1717JuliaSyntax = " 0.4.10, 1"
1818SafeTestsets = " 0.1"
Original file line number Diff line number Diff line change 212212 end
213213
214214 @testset " no arguments" begin
215- @test_throws ErrorException ITensorFormatter. main (String[])
215+ mktempdir () do dir
216+ _, fake_stdin = mktemp (dir)
217+ _, fake_stdout = mktemp (dir)
218+
219+ redirect_stdio (; stdin = fake_stdin, stdout = fake_stdout) do
220+ write (stdin , " using Zebra: z\n using Alpha: a\n x = 1\n " )
221+ seek (stdin , 0 )
222+
223+ ITensorFormatter. main (String[])
224+
225+ seek (stdout , 0 )
226+ result = read (stdout , String)
227+
228+ @test contains (result, " using Alpha: a" )
229+ @test contains (result, " using Zebra: z" )
230+ # Alpha should come before Zebra
231+ @test findfirst (" Alpha" , result) < findfirst (" Zebra" , result)
232+ # Non-import code preserved
233+ @test contains (result, " x = 1" )
234+ end
235+ end
216236 end
217237
218238 @testset " nonexistent path" begin
You can’t perform that action at this time.
0 commit comments