Skip to content

Commit c715a7c

Browse files
Change 'assert' handle to pass only upon exactly 1 argument is received, and the argument is boolean true; update internal test suite correspondingly.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
1 parent 5d385b1 commit c715a7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+138
-137
lines changed

main-linux.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ read_sources (const char *script_file_names[],
113113
/**
114114
* Provide the 'assert' implementation for the engine.
115115
*
116-
* @return true - if the argument was not a boolean value or it was boolean true.
116+
* @return true - if only one argument was passed and the argument is a boolean true.
117117
*/
118118
static bool
119119
assert_handler (const jerry_api_object_t *function_obj_p __attr_unused___, /** < function object */
@@ -122,18 +122,19 @@ assert_handler (const jerry_api_object_t *function_obj_p __attr_unused___, /** <
122122
const jerry_api_value_t args_p[], /** < function arguments */
123123
const jerry_api_length_t args_cnt) /** < number of function arguments */
124124
{
125-
if (args_cnt > 0
125+
if (args_cnt == 1
126126
&& args_p[0].type == JERRY_API_DATA_TYPE_BOOLEAN
127-
&& args_p[0].v_bool != true)
127+
&& args_p[0].v_bool == true)
128+
{
129+
return true;
130+
}
131+
else
128132
{
129133
JERRY_ERROR_MSG ("Script assertion failed\n");
130134
exit (JERRY_STANDALONE_EXIT_CODE_FAIL);
131135
}
132-
133-
return true;
134136
} /* assert_handler */
135137

136-
137138
int
138139
main (int argc,
139140
char **argv)

tests/jerry-test-suite/08/08.01/08.01-010.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
assert(test());
15+
assert (test ());
1616

17-
function test(arg)
17+
function test (arg)
1818
{
1919
if (typeof (arg) === "undefined")
20-
return 1;
20+
return true;
2121
else
22-
return 0;
22+
return false;
2323
}

tests/jerry-test-suite/08/08.01/08.01-011.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
assert(test());
15+
assert (test ());
1616

17-
function test(arg)
17+
function test (arg)
1818
{
1919
if (typeof (arg) === "undefined")
20-
return 1;
20+
return true;
2121
else
22-
return 0;
22+
return false;
2323
}

tests/jerry-test-suite/11/11.11/11.11-009.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -13,5 +13,5 @@
1313
// limitations under the License.
1414

1515
var a = NaN;
16-
var b = new Object();
17-
assert((!a && b))
16+
var b = new Object ();
17+
assert ((!a && b) === b);

tests/jerry-test-suite/11/11.13/11.13.02/11.13.02-012.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
1515
var a = 0xffffffff;
1616
var _a = a;
1717
var b = 4;
18-
assert(a >>= b === _a >> b)
18+
assert ((a >>= b) === (_a >> b));

tests/jerry-test-suite/11/11.13/11.13.02/11.13.02-013.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
1515
var a = 0xffffffff;
1616
var _a = a;
1717
var b = 4;
18-
assert(a <<= b === _a << b)
18+
assert ((a <<= b) === (_a << b));

tests/jerry-test-suite/11/11.13/11.13.02/11.13.02-014.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
1515
var a = 0xffffffff;
1616
var _a = a;
1717
var b = 4;
18-
assert(a >>>= b === _a >>> b)
18+
assert ((a >>>= b) === (_a >>> b));

tests/jerry-test-suite/12/12.01/12.01-002.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
function test()
15+
function test ()
1616
{
1717
{
18-
return 1;
18+
return true;
1919
}
20-
return 0;
20+
return false;
2121
}
2222

23-
assert(test());
23+
assert (test ());

tests/jerry-test-suite/12/12.11/12.11-002.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -29,4 +29,4 @@ switch ("key") {
2929
break;
3030
}
3131

32-
assert(matchesCount === 1 ? 1 : 0);
32+
assert (matchesCount === 1);

tests/jerry-test-suite/12/12.11/12.11-004.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Samsung Electronics Co., Ltd.
1+
// Copyright 2014-2015 Samsung Electronics Co., Ltd.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -25,4 +25,4 @@ switch ("key") {
2525
++counter;
2626
}
2727

28-
assert(counter == 4 ? 1 : 0);
28+
assert (counter == 4);

0 commit comments

Comments
 (0)