test/fixtures/sdk/fdb in flashsdk-1.0.14.pre vs test/fixtures/sdk/fdb in flashsdk-1.0.15.pre

- old
+ new

@@ -1,11 +1,7 @@ #!/usr/bin/env ruby -## -# This is a Fake executable that will behave -# exactly like a real FDB executable for a -# specific, expected set of steps. class FakeFDB def initialize str = "Adobe fdb (Flash Player Debugger) [build 16076]\n" str << "Copyright (c) 2004-2007 Adobe, Inc. All rights reserved.\n" @@ -15,48 +11,80 @@ end def gather_input $stdout.flush command = $stdin.gets.chomp! - if command == "run" - handle_run - elsif command == "continue" - handle_continue - elsif command == "kill" - handle_kill - elsif command == "quit" - handle_quit + parts = command.split(' ') + name = parts.shift + + case name + when "run" + handle_run parts + when "break" + handle_break parts + when "continue" + handle_continue parts + when "kill" + handle_kill parts + when "y" + handle_confirmation parts + when "quit" + handle_quit parts + when "run_with_error" + handle_run_with_error parts else - puts "" - raise "Don't know how to respond to #{command}" + puts "FAKE FDB doesn't know how to respond to #{command}" + exit 1 end + gather_input end - def handle_run + def handle_run args str = "Waiting for Player to connect\n" str << "Player connected; session starting.\n" str << "Set breakpoints and then type 'continue' to resume the session.\n" str = "[SWF] Users:lbayes:Projects:AsUnit-P2:asunit-4.0:bin:AsUnitRunner.swf - 226,833 bytes after decompression\n" str << "(fdb) " printf str end - def handle_continue + def handle_break args str = "Breakpoint 1, AsUnitRunner() at AsUnitRunner.as:12\n" str << "12 core = new TextCore();\n" str << "(fdb) " printf str end - def handle_kill + def handle_continue args + str = "Continuing now\n" + str << "(fdb) " + printf str + end + + def handle_kill args printf "Kill the program being debugged? (y or n) " end - def handle_quit - exit + def handle_confirmation args + str = "Confirmation accepted\n" + str << "(fdb) " + printf str end + def handle_run_with_error args + str = "This is an error!\n" + str << "This is more details about the error!\n" + str << "Here are even more details!\n" + $stderr.printf str + printf "(fdb) " + end + + def handle_quit args + puts ">> EXITING NOW!\n" + exit! 0 + end + end -fdb = FakeFDB.new +fake_fdb = FakeFDB.new