Sha256: 6b0886071e252779fc82a4276b5fa3223dff195352353f1ea076cc84694ff203
Contents?: true
Size: 1.32 KB
Versions: 8
Compression:
Stored size: 1.32 KB
Contents
require 'pione/test-helper' TestHelper.scope do |this| class this::TestProfileReport1 < Util::ProfileReport define_name "test1" define_header("header1") {"value1"} define_header("header2") {"value2"} define_header("header3") {"value3"} end class this::TestClass def initialize(report) Util::Profiler.profile(report) do @executed = true end end def executed? @executed end end describe Pione::Util::Profiler do before do Global.profile_report_directory = Temppath.mkdir Util::Profiler.init end it "should execute code with profile" do # execute with profile Util::Profiler.targets.push("test1") obj = this::TestClass.new(this::TestProfileReport1.new) Util::Profiler.targets.delete("test1") obj.should.executed # check the report Util::Profiler.write_reports Location[Global.profile_report_directory].file_entries do |entry| entry.size.should > 0 end end it "should execute code without profile" do # execute without profile obj = this::TestClass.new(this::TestProfileReport1.new) obj.should.executed # check the report Util::Profiler.write_reports Location[Global.profile_report_directory].file_entries.to_a.size.should == 0 end end end
Version data entries
8 entries across 8 versions & 1 rubygems