Sha256: 38e4109101967a618de7664069442b7ed4bbb39dca4daefdd974acc2b9831255
Contents?: true
Size: 995 Bytes
Versions: 3
Compression:
Stored size: 995 Bytes
Contents
# # Author:: Anders Bengtsson <ndrsbngtssn@yahoo.se> # Copyright:: Copyright (c) 2004-2006 # require 'tempfile' require 'singleton' module Madeleine class SanityCheck include Singleton def initialize @testdata = "\x85\x00\x0a\0x0d\x0a".freeze @was_run = false end def run_once unless @was_run run end end def run marshal_check file_check @was_run = true end def marshal_check result = Marshal.load(Marshal.dump(@testdata)) if result != @testdata raise "Sanity check failed for Marshal" end end def file_check Tempfile.open("madeleine_sanity") do |file| file.binmode # Needed for win32 file.write(@testdata) file.flush open(file.path, 'rb') do |read_file| result = read_file.read if result != @testdata raise "Sanity check failed for file IO" end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
madeleine-0.8.0 | lib/madeleine/sanity.rb |
madeleine-0.8.0.pre | lib/madeleine/sanity.rb |
madeleine-0.7.3 | lib/madeleine/sanity.rb |