dwf/rva: better aliasing for getting to results at each level

This commit is contained in:
pivotal 2008-12-10 10:30:01 -08:00
parent cd135b16f6
commit 72ba4ea90a
3 changed files with 158 additions and 74 deletions

View File

@ -83,7 +83,7 @@
<state /> <state />
</provider> </provider>
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="10" column="7" selection-start="500" selection-end="500" vertical-scroll-proportion="0.19689119"> <state line="12" column="4" selection-start="533" selection-end="533" vertical-scroll-proportion="0.23626943">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -92,16 +92,16 @@
<file leaf-file-name="json_reporter.js" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="json_reporter.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js"> <entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="36" column="7" selection-start="1033" selection-end="1033" vertical-scroll-proportion="0.50870407"> <state line="20" column="0" selection-start="648" selection-end="648" vertical-scroll-proportion="0.21470019">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="bootstrap.js" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="bootstrap.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/test/bootstrap.js"> <entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="767" column="14" selection-start="23386" selection-end="23386" vertical-scroll-proportion="0.37095192"> <state line="863" column="16" selection-start="26512" selection-end="26512" vertical-scroll-proportion="0.46424976">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -110,16 +110,7 @@
<file leaf-file-name="jasmine.js" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="jasmine.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/jasmine.js"> <entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="205" column="0" selection-start="4401" selection-end="4436" vertical-scroll-proportion="0.3491296"> <state line="261" column="49" selection-start="5654" selection-end="5654" vertical-scroll-proportion="0.7172619">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="MIT.LICENSE" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/MIT.LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="18" selection-start="18" selection-end="18" vertical-scroll-proportion="0.0">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -314,32 +305,12 @@
<RUBY_DOC NAME="NUMBER" VALUE="0" /> <RUBY_DOC NAME="NUMBER" VALUE="0" />
</component> </component>
<component name="RunManager"> <component name="RunManager">
<configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby test"> <configuration default="true" type="Remote" factoryName="Remote">
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" /> <option name="USE_SOCKET_TRANSPORT" value="true" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" /> <option name="SERVER_MODE" value="false" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_CLASS_NAME" VALUE="" /> <option name="SHMEM_ADDRESS" value="javadebug" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" /> <option name="HOST" value="localhost" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" /> <option name="PORT" value="5005" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="MODULE_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="INHERITANCE_CHECK_DISABLED" VALUE="false" />
</configuration>
<configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration> </configuration>
<configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false"> <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
<module name="" /> <module name="" />
@ -360,12 +331,32 @@
</option> </option>
<envs /> <envs />
</configuration> </configuration>
<configuration default="true" type="Remote" factoryName="Remote"> <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="USE_SOCKET_TRANSPORT" value="true" /> <option name="MAIN_CLASS_NAME" />
<option name="SERVER_MODE" value="false" /> <option name="VM_PARAMETERS" />
<option name="SHMEM_ADDRESS" value="javadebug" /> <option name="PROGRAM_PARAMETERS" />
<option name="HOST" value="localhost" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="PORT" value="5005" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby test">
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_CLASS_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="MODULE_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="INHERITANCE_CHECK_DISABLED" VALUE="false" />
</configuration> </configuration>
<configuration default="true" type="Applet" factoryName="Applet"> <configuration default="true" type="Applet" factoryName="Applet">
<module name="" /> <module name="" />
@ -430,7 +421,7 @@
</todo-panel> </todo-panel>
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="2" y="22" width="1661" height="1178" extended-state="0" /> <frame x="297" y="22" width="1661" height="1178" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" /> <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
@ -516,39 +507,32 @@
</GetOptions> </GetOptions>
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/MIT.LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="18" selection-start="18" selection-end="18" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.html"> <entry file="file://$PROJECT_DIR$/test/bootstrap.html">
<provider selected="true" editor-type-id="text-editor">
<state line="12" column="4" selection-start="533" selection-end="533" vertical-scroll-proportion="0.23626943">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview"> <provider editor-type-id="HtmlPreview">
<state /> <state />
</provider> </provider>
<provider selected="true" editor-type-id="text-editor">
<state line="10" column="7" selection-start="500" selection-end="500" vertical-scroll-proportion="0.19689119">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
<provider selected="true" editor-type-id="text-editor">
<state line="36" column="7" selection-start="1033" selection-end="1033" vertical-scroll-proportion="0.50870407">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor">
<state line="767" column="14" selection-start="23386" selection-end="23386" vertical-scroll-proportion="0.37095192">
<folding />
</state>
</provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/example.html"> <entry file="file://$PROJECT_DIR$/example/example.html">
<provider editor-type-id="HtmlPreview">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="721" vertical-scroll-proportion="0.0"> <state line="0" column="0" selection-start="0" selection-end="721" vertical-scroll-proportion="0.0">
<folding /> <folding />
</state> </state>
</provider> </provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.css"> <entry file="file://$PROJECT_DIR$/lib/jasmine.css">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -564,16 +548,23 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.js"> <entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="205" column="0" selection-start="4401" selection-end="4436" vertical-scroll-proportion="0.3491296"> <state line="20" column="0" selection-start="648" selection-end="648" vertical-scroll-proportion="0.21470019">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/MIT.LICENSE"> <entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="0" column="18" selection-start="18" selection-end="18" vertical-scroll-proportion="0.0"> <state line="261" column="49" selection-start="5654" selection-end="5654" vertical-scroll-proportion="0.7172619">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor">
<state line="863" column="16" selection-start="26512" selection-end="26512" vertical-scroll-proportion="0.46424976">
<folding /> <folding />
</state> </state>
</provider> </provider>

View File

@ -259,6 +259,7 @@ var it = function (description, func) {
return that; return that;
} }
that.expectationResults = that.results.results;
that.runs = addToQueue; that.runs = addToQueue;
jasmine.currentSuite.specs.push(that); jasmine.currentSuite.specs.push(that);
@ -300,6 +301,7 @@ var describe = function (description, spec_definitions) {
spec_definitions(); spec_definitions();
that.results.description = description; that.results.description = description;
that.specResults = that.results.results;
that.finishCallback = function () { that.finishCallback = function () {
if (jasmine.reporter) { if (jasmine.reporter) {
@ -322,6 +324,8 @@ var Runner = function () {
} }
} }
that.suiteResults = that.results.results;
jasmine.currentRunner = that; jasmine.currentRunner = that;
return that; return that;
} }

91
test/bootstrap.js vendored
View File

@ -760,6 +760,93 @@ var testJSONReporterWithDOM = function () {
}, 250); }, 250);
} }
var testHandlesBlankSpecs = function () {
jasmine = Jasmine.init();
var runner = Runner();
describe('Suite for handles blank specs', function () {
it('should be a test with a blank runs block', function() {
runs(function () {
});
});
it('should be a blank (empty function) test', function() {
});
});
runner.execute();
setTimeout(function() {
reporter.test((runner.results.results[0].results.results.length === 2),
'Should have found 2 spec results, got ' + runner.results.results[0].results.results.length );
reporter.test((runner.results.results[0].results.passedCount === 2),
'Should have found 2 passing specs, got ' + runner.results.results[0].results.passedCount);
}, 250);
}
var testResultsAliasing = function () {
jasmine = Jasmine.init();
var runner = Runner();
describe('Suite for result aliasing test', function () {
it('should be a test', function() {
runs(function () {
this.expects_that(true).should_equal(true);
});
});
});
describe('Suite number two for result aliasing test', function () {
it('should be a passing test', function() {
runs(function () {
this.expects_that(true).should_equal(true);
});
});
it('should be a passing test', function() {
runs(function () {
this.expects_that(true).should_equal(true);
});
});
});
runner.execute();
setTimeout(function() {
reporter.test((runner.suiteResults !== undefined),
'runner.suiteResults was not defined');
reporter.test((runner.suiteResults == runner.results.results),
'runner.suiteResults should have been ' + Object.toJSON(runner.results.results) +
', but was ' + Object.toJSON(runner.suiteResults));
reporter.test((runner.suiteResults[1] == runner.results.results[1]),
'runner.suiteResults should have been ' + Object.toJSON(runner.results.results[1]) +
', but was ' + Object.toJSON(runner.suiteResults[1]));
reporter.test((runner.suites[0].specResults !== undefined),
'runner.suites[0].specResults was not defined');
reporter.test((runner.suites[0].specResults == runner.results.results[0].results),
'runner.suites[0].specResults should have been ' + Object.toJSON(runner.results.results[0].results) +
', but was ' + Object.toJSON(runner.suites[0].specResults));
reporter.test((runner.suites[0].specs[0].expectationResults !== undefined),
'runner.suites[0].specs[0].expectationResults was not defined');
reporter.test((runner.suites[0].specs[0].expectationResults == runner.results.results[0].results[0].results),
'runner.suites[0].specs[0].expectationResults should have been ' + Object.toJSON(runner.results.results[0].results[0].results) +
', but was ' + Object.toJSON(runner.suites[0].specs[0].expectationResults));
}, 250);
}
var runTests = function () { var runTests = function () {
$('spinner').show(); $('spinner').show();
@ -775,11 +862,12 @@ var runTests = function () {
testRunnerFinishCallback(); testRunnerFinishCallback();
testNestedResults(); testNestedResults();
testResults(); testResults();
// testHandlesBlankSpecs();
// Timing starts to matter with these tests; ALWAYS use setTimeout() // Timing starts to matter with these tests; ALWAYS use setTimeout()
setTimeout(function () { setTimeout(function () {
testReporterWithCallbacks(); testReporterWithCallbacks();
}, 2000); }, 2500);
setTimeout(function () { setTimeout(function () {
testJSONReporter(); testJSONReporter();
}, 3500); }, 3500);
@ -787,6 +875,7 @@ var runTests = function () {
testJSONReporterWithDOM(); testJSONReporterWithDOM();
}, 5000); }, 5000);
testResultsAliasing();
setTimeout(function() { setTimeout(function() {
$('spinner').hide(); $('spinner').hide();
reporter.summary(); reporter.summary();