# File test/testhelper.rb, line 27
def sniff_url(url,expected_image_format,expected_file_system,expected_files=nil)
    assert(FileSystemImage.is_file_system_image_filename?(url),"#{url} should have a known file system image extension")
    image=@@filecache.get_file_system_image(url)    
    assert_equal(expected_file_system,image.file_system,"validation of file system for #{url}")
    assert_kind_of(expected_image_format,image.image_format,"validation of image format for #{url}")
    assert_not_nil(image.image_format.host_system.full_name,"all host systems should implement :full_name")
    return if expected_files.nil?
    expected_files.each do |expected_file|
      expected_file_filename=expected_file[:filename]
      RipXploreLog.info("validating #{expected_file_filename}")
      raise "no native files identified in image" if image.files.nil? || image.files.length==0
      raise "image.files should of type FileContainer but was #{image.files.class} (file system=#{image.file_system})" unless image.files.kind_of?(FileContainer)
      native_file=image.files[expected_file_filename]
      assert_not_nil(native_file,"#{expected_file_filename} should exist in #{url} - files found: #{image.catalog}")
      expected_native_file_type=expected_file[:expected_native_file_type]            
      unless  expected_native_file_type.nil? then
        assert_kind_of(expected_native_file_type,native_file,"native file type of #{expected_file_filename} should be as specified")
      end
      unless  expected_file[:load_address].nil? then
        assert(expected_file[:load_address]==native_file.load_address,"load address of #{expected_file_filename} should be $#{"%04x" % expected_file[:load_address]} but was $#{"%04X" % native_file.load_address}")
      end
      
      unless  expected_file[:can_execute].nil? then
        method_to_call=expected_file[:can_execute]
        native_file.send(method_to_call)        
      end
      
      unless  expected_file[:save_output].nil? then
        (method_to_call,extension)=expected_file[:save_output]              
        file_cache.purge_native_file_from_cache(native_file)
        file_cache.force_native_file_to_cache(native_file,method_to_call,extension)
      end
      expected_file_text_starts_with=expected_file[:text_starts_with]
      unless expected_file_text_starts_with.nil? then
        assert(native_file.respond_to?(:to_text),"#{expected_file_filename} should respond to :to_text")
        assert_equal(expected_file_text_starts_with,native_file.to_text[0,expected_file_text_starts_with.length],"start of #{expected_file_filename} should be as specified")
      end

      expected_file_listing_starts_with=expected_file[:listing_starts_with]
      unless expected_file_listing_starts_with.nil? then
        assert(native_file.respond_to?(:to_listing),"#{expected_file_filename} should respond to :to_listing")
        assert_equal(expected_file_listing_starts_with,native_file.to_listing[0,expected_file_listing_starts_with.length],"start of #{expected_file_filename} should be as specified")
      end

    end
  end