Skip to content

Commit

Permalink
Merge pull request #4825 from erikmaarten/rename-check-function
Browse files Browse the repository at this point in the history
Rename check function ('boolean' -> 'bool')
  • Loading branch information
Hannah authored Jan 9, 2017
2 parents 7253588 + 18c84a6 commit a6a0897
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 3 additions & 7 deletions Source/Core/Check.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/*global define*/
define([
'./defaultValue',
'./defined',
'./DeveloperError',
'./isArray'
'./DeveloperError'
], function(
defaultValue,
defined,
DeveloperError,
isArray) {
DeveloperError) {
'use strict';

/**
Expand Down Expand Up @@ -140,7 +136,7 @@ define([
* @param {String} name The name of the variable being tested
* @exception {DeveloperError} test must be typeof 'boolean'
*/
Check.typeOf.boolean = function (test, name) {
Check.typeOf.bool = function (test, name) {
if (typeof test !== 'boolean') {
throw new DeveloperError(getFailedTypeErrorMessage(typeof test, 'boolean', name));
}
Expand Down
14 changes: 7 additions & 7 deletions Specs/Core/CheckSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ defineSuite([
'use strict';

describe('type checks', function () {
it('Check.typeOf.boolean does not throw when passed a boolean', function () {
it('Check.typeOf.bool does not throw when passed a boolean', function () {
expect(function () {
Check.typeOf.boolean(true);
Check.typeOf.bool(true);
}).not.toThrowDeveloperError();
});

it('Check.typeOf.boolean throws when passed a non-boolean', function () {
expect(function () {
Check.typeOf.boolean({}, 'mockName');
Check.typeOf.bool({}, 'mockName');
}).toThrowDeveloperError();
expect(function () {
Check.typeOf.boolean([], 'mockName');
Check.typeOf.bool([], 'mockName');
}).toThrowDeveloperError();
expect(function () {
Check.typeOf.boolean(1, 'mockName');
Check.typeOf.bool(1, 'mockName');
}).toThrowDeveloperError();
expect(function () {
Check.typeOf.boolean('snth', 'mockName');
Check.typeOf.bool('snth', 'mockName');
}).toThrowDeveloperError();
expect(function () {
Check.typeOf.boolean(function () {return true;}, 'mockName');
Check.typeOf.bool(function () {return true;}, 'mockName');
}).toThrowDeveloperError();
});

Expand Down

0 comments on commit a6a0897

Please sign in to comment.