dwf: started moving Exceptions tests from bootstrap to runner

This commit is contained in:
Davis W. Frank 2009-06-15 08:28:14 -07:00
parent 95b52b9f82
commit 6a2602f243
3 changed files with 35 additions and 72 deletions

View File

@ -1,72 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jasmine Test Runner</title>
</head>
<script type="text/javascript" src="src/base.js"></script>
<script type="text/javascript" src="src/util.js"></script>
<script type="text/javascript" src="src/Env.js"></script>
<script type="text/javascript" src="src/ActionCollection.js"></script>
<script type="text/javascript" src="src/Matchers.js"></script>
<script type="text/javascript" src="src/NestedResults.js"></script>
<script type="text/javascript" src="src/PrettyPrinter.js"></script>
<script type="text/javascript" src="src/QueuedFunction.js"></script>
<script type="text/javascript" src="src/Reporters.js"></script>
<script type="text/javascript" src="src/Runner.js"></script>
<script type="text/javascript" src="src/Spec.js"></script>
<script type="text/javascript" src="src/Suite.js"></script>
<script type="text/javascript" src="lib/TrivialReporter.js"></script>
<script type="text/javascript" src="lib/json_reporter.js"></script>
<script type="text/javascript" src="test/json2.js"></script>
<script type="text/javascript" src="test/mock-timeout.js"></script>
<script type="text/javascript">
jasmine.include('test/JsonReporterTest.js', true);
jasmine.include('test/MatchersTest.js', true);
jasmine.include('test/NestedResultsTest.js', true);
jasmine.include('test/PrettyPrintTest.js', true);
jasmine.include('test/ReporterTest.js', true);
jasmine.include('test/RunnerTest.js', true);
jasmine.include('test/SpecRunningTest.js', true);
jasmine.include('test/SpyTest.js', true);
</script>
<style type="text/css">
.spec {
margin: 5px;
}
.passed {
background-color: lightgreen;
}
.failed {
background-color: pink;
}
.resultMessage {
white-space: pre;
}
.stackTrace {
white-space: pre;
font-size: .8em;
margin-left: 10px;
}
</style>
<body>
<script type="text/javascript">
var jasmineEnv = jasmine.getEnv();
jasmineEnv.reporter = new jasmine.TrivialReporter();
jasmineEnv.execute();
console.log('env', jasmineEnv);
</script>
</body>
</html>

View File

@ -25,6 +25,7 @@
<script type="text/javascript" src="lib/mock-timeout.js"></script>
<script type="text/javascript">
jasmine.include('suites/ExceptionsTest.js', true);
jasmine.include('suites/JsonReporterTest.js', true);
jasmine.include('suites/MatchersTest.js', true);
jasmine.include('suites/NestedResultsTest.js', true);

View File

@ -0,0 +1,34 @@
describe('Exceptions:', function() {
var env;
beforeEach(function() {
env = new jasmine.Env();
});
it('jasmine.formatException formats Firefox exception maessages as expected', function() {
var sampleFirefoxException = {
fileName: 'foo.js',
line: '1978',
message: 'you got your foo in my bar',
name: 'A Classic Mistake'
};
var expected = 'A Classic Mistake: you got your foo in my bar in foo.js (line 1978)';
expect(jasmine.util.formatException(sampleFirefoxException)).toEqual(expected);
});
it('jasmine.formatException formats Webkit exception maessages as expected', function() {
var sampleWebkitException = {
sourceURL: 'foo.js',
lineNumber: '1978',
message: 'you got your foo in my bar',
name: 'A Classic Mistake'
};
var expected = 'A Classic Mistake: you got your foo in my bar in foo.js (line 1978)';
expect(jasmine.util.formatException(sampleWebkitException)).toEqual(expected);
});
});