0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

190 Commits

Author SHA1 Message Date
Ben Noordhuis
21130c7d6f lib: turn on strict mode
Turn on strict mode for the files in the lib/ directory.  It helps
catch bugs and can have a positive effect on performance.

PR-URL: https://github.com/node-forward/node/pull/64
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-11-22 17:23:30 +01:00
Fedor Indutny
f310c0f16b Merge remote-tracking branch 'origin/v0.10' into master
Conflicts:
	doc/api/buffer.markdown
	lib/_stream_readable.js
	lib/assert.js
	lib/buffer.js
	lib/child_process.js
	lib/http.js
	lib/string_decoder.js
	lib/zlib.js
	node.gyp
	test/simple/test-buffer.js
	test/simple/test-https-foafssl.js
	test/simple/test-stream2-compatibility.js
	test/simple/test-tls-server-verify.js
2014-07-29 12:51:27 +04:00
cjihrig
b87ca794e3 lib: remove and restructure calls to isNaN()
Switch condition order to check for null before calling isNaN().
Also remove two unnecessary calls to isNaN() that are already
covered by calls to isFinite(). This commit targets v0.10, as
opposed to #7891, which targets master (suggested by
@bnoordhuis). Closes #7840.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-10 15:21:50 +03:00
Fedor Indutny
78d245f5b2 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	configure
	lib/_stream_readable.js
	lib/http.js
	src/node_dtrace.cc
2014-03-02 23:54:19 +04:00
Mike Pennisi
aae51ecf7d assert: Ensure reflexivity of deepEqual
Ensure that the behavior of `assert.deepEqual` does not depend on
argument ordering  when comparing an `arguments` object with a
non-`arguments` object.
2014-02-25 20:32:49 +04:00
Glen Mailer
66b8c3c5a0 assert: indicate if exception message is generated
AssertionError.generatedMessage is now true when
AssertionError.message was generated from expected and actual

Fixes #5836, #6206
2013-10-11 10:15:03 -07:00
isaacs
22c68fdc1d src: Replace macros with util functions 2013-08-01 15:08:01 -07:00
Ben Noordhuis
dc9acd4fae assert: replace !!!value with just !value
Not harmful, just code cleanup.

Fixes #5885.
2013-07-30 13:29:20 +02:00
Ben Noordhuis
0330bdf519 lib: macro-ify type checks
Increases the grep factor. Makes it easier to harmonize type checks
across the code base.
2013-07-24 21:49:35 +02:00
isaacs
0b8af89363 lint 2013-05-14 11:36:04 -07:00
isaacs
c77312405e lint 2013-04-19 16:25:11 -07:00
Ryan Doenges
6101eb184d assert: put info in err.message, not err.name
4716dc6 made assert.equal() and related functions work better by
generating a better toString() from the expected, actual, and operator
values passed to fail(). Unfortunately, this was accomplished by putting
the generated message into the error's `name` property. When you passed
in a custom error message, the error would put the custom error into
`name` *and* `message`, resulting in helpful string representations like
"AssertionError: Oh no: Oh no".

This commit resolves that issue by storing the generated message in the
`message` property while leaving the error's name alone and adding
a regression test so that this doesn't pop back up later.

Closes #5292.
2013-04-18 15:08:35 -07:00
isaacs
4716dc662d assert: Simplify AssertError creation 2013-04-03 09:52:56 -07:00
lukebayes
ae1b0ca7a5 assert: improve support for new execution contexts
More detailed information in GH-693
2012-12-29 11:19:14 -08:00
Ben Noordhuis
e4cef1a083 doc: update assert.doesNotThrow() docs
It takes an optional "expected exception" argument that is not used meaningfully
but is nevertheless documented. Undocument it, it confuses casual readers of the
documentation.

Fixes #3935.
2012-08-29 02:36:22 +02:00
koichik
72bc4dcda4 assert: fix throws() throws an error without message property
Fixes #2893.
2012-07-29 19:48:16 +09:00
Nathan Rajlich
9eddaebb79 assert: remove unnecessary use of __proto__
AssertionError already inherits from Error above using util.inherits(),
so this extra line was redundant.

test/simple/test-assert.js already tests for `instanceof`, and still passes.
2012-07-25 10:41:08 -07:00
Nao Iizuka
f8ce384446 docs: correct the description of assert.ok() 2012-03-12 02:27:55 +01:00
Maciej Małecki
5c7532e5b3 assert: test RegExp's properties when checking for equality
Previous code ignored the fact that `/a/ != /a/g`.

Test case included.
2011-12-20 00:10:49 +01:00
Pedro Teixeira
a805012d6f assert: .deepEqual() support for RegExp objects 2011-12-20 00:10:38 +01:00
Colton Baker
87286cc737 Fixed a lot of jslint errors.
Fixes #1831
2011-10-05 18:51:06 -07:00
Maciej Małecki
8c8d518723 assert: Make assert module an assert.ok function
Code can be written:

    var assert = require('assert');
    assert(true);

instead of:

    var assert = require('assert');
    assert.ok(true);
2011-10-02 02:25:52 +02:00
Ryan Dahl
0696e78d64 Improve assert error messages
1. actual and expected should be displayed in the same order they were given

2. long values should be truncated.
2011-08-09 14:20:06 -07:00
koichik
5f97c9a005 Improvements AssertionError message
Fixes #217.
2011-07-14 02:08:24 +09:00
Ryan Dahl
5a05992155 Lint 2011-01-06 16:06:27 -08:00
Oleg Slobodskoi
23cf938e4f fix assert.throws 2010-12-21 12:41:57 -08:00
Ryan Dahl
db78043d52 lint 2010-12-01 16:42:31 -08:00
Oleg Slobodskoi
02083412eb assert.throws can now accept as RegExp
makes validation of errors more flexible
2010-11-29 17:22:36 -08:00
Micheil Smith
e38eb0c5a4 Soft migration of sys -> util, Removal of deprecated utils module. 2010-10-11 15:21:36 -07:00
Joshaven Potter
3d4e4d8909 syntax fixes to pass jslint 2010-10-06 20:40:57 -07:00
Ryan Dahl
1be722a271 Special deepEquals for buffer 2010-09-07 17:14:04 -07:00
Mikeal Rogers
fe3d8f2411 Add assert.ifError 2010-05-21 12:06:12 -07:00
isaacs
57fbb627ca trailing whitespace fixes 2010-04-11 14:48:23 -07:00
Ryan Dahl
4ccdc501d4 Include lib/ directory in node executable. Compile on demand.
Instead of installing the files in /usr/lib/node/libraries and loading them
from the file system, the files are built-in to the node executable.
However, they are only compiled on demand.

The reasoning is:
  1. Allow for more complex internal javascript. In particular,
  process.stdout and process.stdin can be js implemented streams.

  2. Ease system installs. Loading from disk each time is unnecessary
  overhead. Note that there is no "system" path for modules anymore. Only
  $HOME/.node_libraries.
2010-03-15 08:04:35 -07:00
Ryan Dahl
b021a845f7 Move process.inherits to sys 2010-03-01 11:39:35 -08:00
Ryan Dahl
c420c89dbd Make assert.AssertionError instance of Error 2010-01-24 14:39:32 -08:00
Ryan Dahl
0accebe583 Stack trace for asserts shouldn't include assert module 2009-12-29 20:15:05 +01:00
Ryan Dahl
dd35637603 Fix assert.js code style 2009-12-29 20:10:59 +01:00
Karl Guertin
4f679fd8d0 Dependency free assert module with unit tests 2009-12-05 01:05:16 +01:00
Felix Geisendörfer
530328f12b CommonJS testing for node.js
Refactored test suite to use the assert module for testing rather than
mjsunit.
2009-12-05 01:05:16 +01:00