blob: d26898ccfa4e60f1bcdc14722336c03625911340 [file] [log] [blame]
<!DOCTYPE html>
<html>
<!--
Copyright 2012 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<title>Closure Unit Tests - goog.result.*</title>
<script src="../base.js"></script>
<script>
goog.require('goog.result');
goog.require('goog.testing.jsunit');
</script>
</head>
<body>
<script>
function testSuccessfulResult() {
var value = 'some-value';
var result = goog.result.successfulResult(value);
assertEquals(goog.result.Result.State.SUCCESS, result.getState());
assertEquals(value, result.getValue());
}
function testFailedResult() {
var error = new Error('something-failed');
var result = goog.result.failedResult(error);
assertEquals(goog.result.Result.State.ERROR, result.getState());
assertEquals(error, result.getError());
}
function testCanceledResult() {
var result = goog.result.canceledResult();
assertEquals(goog.result.Result.State.ERROR, result.getState());
var error = result.getError();
assertTrue(error instanceof goog.result.Result.CancelError);
}
</script>
</body>
</html>