Skip to content

Commit

Permalink
dwf/rva: added better exception handling for Webkit
Browse files Browse the repository at this point in the history
  • Loading branch information
pivotalops committed Jan 15, 2009
1 parent 183b06b commit c94496c
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 66 deletions.
92 changes: 46 additions & 46 deletions jasmine.iws
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<file leaf-file-name="bootstrap.html" pinned="false" current="false" current-in-tab="false">
<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.25249168">
<state line="12" column="4" selection-start="533" selection-end="533" vertical-scroll-proportion="0.23799582">
<folding />
</state>
</provider>
Expand All @@ -89,19 +89,19 @@
</provider>
</entry>
</file>
<file leaf-file-name="bootstrap.js" pinned="false" current="true" current-in-tab="true">
<file leaf-file-name="bootstrap.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor">
<state line="842" column="193" selection-start="26377" selection-end="26377" vertical-scroll-proportion="0.94043887">
<state line="893" column="101" selection-start="27681" selection-end="27681" vertical-scroll-proportion="0.6620553">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="jasmine.js" pinned="false" current="false" current-in-tab="false">
<file leaf-file-name="jasmine.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor">
<state line="389" column="1" selection-start="8626" selection-end="8626" vertical-scroll-proportion="0.88271606">
<state line="246" column="7" selection-start="5573" selection-end="5573" vertical-scroll-proportion="0.4935065">
<folding />
</state>
</provider>
Expand All @@ -122,7 +122,7 @@
<file leaf-file-name="jasmine.css" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/jasmine.css">
<provider selected="true" editor-type-id="text-editor">
<state line="17" column="36" selection-start="351" selection-end="351" vertical-scroll-proportion="0.33230454">
<state line="17" column="36" selection-start="351" selection-end="351" vertical-scroll-proportion="0.3145083">
<folding />
</state>
</provider>
Expand All @@ -131,7 +131,7 @@
<file leaf-file-name="example.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/example.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="0" selection-start="183" selection-end="183" vertical-scroll-proportion="0.11728395">
<state line="6" column="0" selection-start="183" selection-end="183" vertical-scroll-proportion="0.11100292">
<folding />
</state>
</provider>
Expand Down Expand Up @@ -296,6 +296,13 @@
<RUBY_DOC NAME="NUMBER" VALUE="0" />
</component>
<component name="RunManager">
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</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="" />
Expand All @@ -310,24 +317,17 @@
<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="JUnit" factoryName="JUnit" enabled="false" merge="false">
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="ADDITIONAL_CLASS_PATH" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
<envs />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
</configuration>
<configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" />
Expand All @@ -342,24 +342,24 @@
<module name="" />
<envs />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="ADDITIONAL_CLASS_PATH" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
<envs />
</configuration>
<list size="0" />
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
Expand Down Expand Up @@ -412,13 +412,13 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="43" y="39" width="1862" height="1116" extended-state="0" />
<frame x="26" y="22" width="1833" height="1171" extended-state="0" />
<editor active="true" />
<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="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="7" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2107005" order="0" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2102018" order="0" />
<window_info id="RDoc" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32837301" order="1" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
Expand Down Expand Up @@ -514,7 +514,7 @@
</entry>
<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.25249168">
<state line="12" column="4" selection-start="533" selection-end="533" vertical-scroll-proportion="0.23799582">
<folding />
</state>
</provider>
Expand All @@ -534,28 +534,28 @@
</entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.css">
<provider selected="true" editor-type-id="text-editor">
<state line="17" column="36" selection-start="351" selection-end="351" vertical-scroll-proportion="0.33230454">
<state line="17" column="36" selection-start="351" selection-end="351" vertical-scroll-proportion="0.3145083">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/example.js">
<provider selected="true" editor-type-id="text-editor">
<state line="6" column="0" selection-start="183" selection-end="183" vertical-scroll-proportion="0.11728395">
<state line="6" column="0" selection-start="183" selection-end="183" vertical-scroll-proportion="0.11100292">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor">
<state line="389" column="1" selection-start="8626" selection-end="8626" vertical-scroll-proportion="0.88271606">
<state line="893" column="101" selection-start="27681" selection-end="27681" vertical-scroll-proportion="0.6620553">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor">
<state line="842" column="193" selection-start="26377" selection-end="26377" vertical-scroll-proportion="0.94043887">
<state line="246" column="7" selection-start="5573" selection-end="5573" vertical-scroll-proportion="0.4935065">
<folding />
</state>
</provider>
Expand Down
40 changes: 38 additions & 2 deletions lib/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ Jasmine.Matchers.method('should_be_defined', function () {
'Expected ' + this.actual + ' to be defined.');
});

Jasmine.Matchers.method('innerHTML_should_match', function (reg_exp) {
return this.report((reg_exp.match(this.actual.innerHTML)),
'Expected ' + this.actual.innerHTML + ' to match ' + reg_exp + '.');
});

/*
* Jasmine spec constructor
*/
Expand Down Expand Up @@ -254,8 +259,7 @@ var it = function (description, func) {
catch (e) {
that.results.push({
passed: false,
message: e.name + ': '+ e.message + ' in ' + e.fileName +
' (line ' + e.lineNumber +')'
message: Jasmine.Util.formatException(e)
});
queuedFunc.next();
}
Expand Down Expand Up @@ -387,4 +391,36 @@ Jasmine.Reporters.reporter = function (callbacks) {
}

return that;
}

Jasmine.Util = {
formatException: function(e) {
// if (typeof e === 'String') {
// return e;
// }
var lineNumber;
if (e.line) {
lineNumber = e.line;
}
else if (e.lineNumber) {
lineNumber = e.lineNumber;
}

var file;

if (e.sourceURL) {
file = e.sourceURL;
}
else if (e.fileName) {
file = e.fileName;
}

var message = e.name + ': ' + e.message;
if (file && lineNumber) {
message += ' in ' + file +' (line ' + lineNumber + ')';
}

return message;
}

}
Loading

0 comments on commit c94496c

Please sign in to comment.