@@ -59,24 +59,36 @@ def test_key_mtime
5959 end
6060
6161 def test_fetch
62+ # if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
63+ # # Always pass this test on Windows, because I can't find an equivalent for
64+ # # /dev/null for this test
65+ # # I thought this would work but it fails to find it
66+ # # if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
67+ # # target = "NUL:"
68+ # # else
69+ # # target = '/dev/null'
70+ # # end
71+ # pass
72+ # else
73+ # actual = Bootsnap::CompileCache::Native.fetch(@tmp_dir, '/dev/null', TestHandler)
74+ # assert_equal('NEATO /DEV/NULL', actual)
75+ # data = File.read("#{@tmp_dir}/8c/d2d180bbd995df")
76+ # assert_equal("neato /dev/null", data.force_encoding(Encoding::BINARY)[64..-1])
77+ # actual = Bootsnap::CompileCache::Native.fetch(@tmp_dir, '/dev/null', TestHandler)
78+ # assert_equal('NEATO /DEV/NULL', actual)
79+ # end
6280 if RbConfig ::CONFIG [ 'host_os' ] =~ /mswin|mingw|cygwin/
63- # Always pass this test on Windows, because I can't find an equivalent for
64- # /dev/null for this test
65- # I thought this would work but it fails to find it
66- # if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
67- # target = "NUL:"
68- # else
69- # target = '/dev/null'
70- # end
71- pass
81+ target = "NUL:"
7282 else
73- actual = Bootsnap ::CompileCache ::Native . fetch ( @tmp_dir , '/dev/null' , TestHandler )
74- assert_equal ( 'NEATO /DEV/NULL' , actual )
75- data = File . read ( "#{ @tmp_dir } /8c/d2d180bbd995df" )
76- assert_equal ( "neato /dev/null" , data . force_encoding ( Encoding ::BINARY ) [ 64 ..-1 ] )
77- actual = Bootsnap ::CompileCache ::Native . fetch ( @tmp_dir , '/dev/null' , TestHandler )
78- assert_equal ( 'NEATO /DEV/NULL' , actual )
83+ target = '/dev/null'
7984 end
85+
86+ actual = Bootsnap ::CompileCache ::Native . fetch ( @tmp_dir , 'NUL:' , TestHandler )
87+ assert_equal ( 'NEATO NUL:' , actual )
88+ data = File . read ( "#{ @tmp_dir } /8c/d2d180bbd995df" )
89+ assert_equal ( "neato nul" , data . force_encoding ( Encoding ::BINARY ) [ 64 ..-1 ] )
90+ actual = Bootsnap ::CompileCache ::Native . fetch ( @tmp_dir , 'NUL' , TestHandler )
91+ assert_equal ( 'NEATO nul' , actual )
8092 end
8193
8294 def test_unexistent_fetch
0 commit comments