Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename check function ('boolean' -> 'bool') #4825

Merged
merged 2 commits into from
Jan 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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