Update jerry-port and jerry-ext (#4907)
Notable changes:
- Updated and the port API interface, new functions have been added
and some have been changed. The port library is now cleaned up to
not have any dependency on jerry-core, as it should be. The port library
is now strictly a collection of functions that implement
embedding/platform specific behavior.
- The default port implementation has been split for windows and unix.
Implemented port functions have been categorized and reorganized,
and marked with attribute((weak)) for better reusability.
- External context allocation has been moved to the port API instead
of a core API callback. The iterface has also been extended with a
function to free the allocated context. When external context is
enabled, jerry_init now automatically calls the port implementation
to allocate the context and jerry_cleanup automatically calls the port
to free the context.
- jerry_port_log has been changed to no longer require formatting to
be implemented by the port. The reason beind this is that it was vague what
format specifiers were used by the engine, and in what manner. The port
function now takes a zero-terminated string, and should only implement
how the string should be logged.
- Logging and log message formatting is now handled by the core jerry library
where it can be implemented as necessary. Logging can be done through a new
core API function, which uses the port to output the final log message.
- Log level has been moved into jerry-core, and an API function has
been added to set the log level. It should be the library that
filters log messages based on the requested log level, instead of
logging everything and requiring the user to do so.
- Module resolving logic has been moved into jerry-core. There's no
reason to have it in the port library and requiring embedders to
duplicate the code. It also added an unnecessary dependency on
jerry-core to the port. Platform specific behavior is still used through
the port API, like resolving module specifiers, and reading source file
contents. If necessary, the resolving logic can still be overridden as
previously.
- The jerry-ext library has also been cleaned up, and many utility
functions have been added that previously were implemented in
jerry-main. This allows easier reusability for some common operations,
like printing unhandled exceptions or providing a repl console.
- Debugger interaction with logged/printed messages has been fixed, so
that it's no longer the port implementations responsibility to send
the output to the debugger, as the port should have no notion of what a
debugger is. The printing and logging functions will now pass the
result message to the debugger, if connected.
- Cleaned up TZA handling in the date port implementation, and simplified
the API function prototype.
- Moved property access helper functions that use ASCII strings as
keys from jerry-ext to the core API.
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/client_source.js:15
|
||||
(jerry-debugger) s
|
||||
out: client-source-test
|
||||
client-source-test
|
||||
Stopped at tests/debugger/client_source.js:40
|
||||
(jerry-debugger) s
|
||||
Stopped at tests/debugger/client_source.js:35 (in test() at line:33, col:1)
|
||||
(jerry-debugger) s
|
||||
out: function test
|
||||
function test
|
||||
Stopped at tests/debugger/client_source.js:36 (in test() at line:33, col:1)
|
||||
(jerry-debugger) continue
|
||||
out: function foo
|
||||
out: function bar
|
||||
out: function finish
|
||||
out: finish: test-foo-bar
|
||||
function foo
|
||||
function bar
|
||||
function finish
|
||||
finish: test-foo-bar
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/client_source_multiple_2.js:15
|
||||
(jerry-debugger) n
|
||||
out: multiple-client-source-test-file-2
|
||||
multiple-client-source-test-file-2
|
||||
Stopped at tests/debugger/client_source_multiple_1.js:15
|
||||
(jerry-debugger) n
|
||||
out: multiple-client-source-test-file-1
|
||||
multiple-client-source-test-file-1
|
||||
Stopped at tests/debugger/client_source_multiple_1.js:27
|
||||
(jerry-debugger) s
|
||||
Stopped at tests/debugger/client_source_multiple_1.js:18 (in foo() at line:17, col:1)
|
||||
(jerry-debugger) s
|
||||
out: foo
|
||||
foo
|
||||
Stopped at tests/debugger/client_source_multiple_1.js:19 (in foo() at line:17, col:1)
|
||||
(jerry-debugger) s
|
||||
Stopped at tests/debugger/client_source_multiple_2.js:18 (in bar() at line:17, col:1)
|
||||
(jerry-debugger) s
|
||||
out: bar
|
||||
bar
|
||||
Stopped at tests/debugger/client_source_multiple_2.js:19 (in bar() at line:17, col:1)
|
||||
(jerry-debugger) c
|
||||
out: str-argument: called-from-test-file-1
|
||||
out: crossFoo
|
||||
out: str-argument: called-from-test-file-2
|
||||
str-argument: called-from-test-file-1
|
||||
crossFoo
|
||||
str-argument: called-from-test-file-2
|
||||
|
||||
@@ -9,4 +9,4 @@ Stopped at tests/debugger/do_abort.js:20 (in g() at line:19, col:1)
|
||||
(jerry-debugger) s
|
||||
Stopped at tests/debugger/do_abort.js:16 (in f() at line:15, col:1)
|
||||
(jerry-debugger) abort new Error('Fatal error :)')
|
||||
err: Unhandled exception: Error: Fatal error :)
|
||||
Unhandled exception: Error: Fatal error :)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_backtrace.js:15
|
||||
(jerry-debugger) next
|
||||
out: backtrace-test
|
||||
backtrace-test
|
||||
Stopped at tests/debugger/do_backtrace.js:28
|
||||
(jerry-debugger) n
|
||||
Stopped at tests/debugger/do_backtrace.js:37
|
||||
@@ -10,7 +10,7 @@ Stopped at tests/debugger/do_backtrace.js:40
|
||||
(jerry-debugger) step
|
||||
Stopped at tests/debugger/do_backtrace.js:32 (in test() at line:30, col:1)
|
||||
(jerry-debugger) next
|
||||
out: function test
|
||||
function test
|
||||
Stopped at tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)
|
||||
(jerry-debugger) s
|
||||
Stopped at tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)
|
||||
@@ -36,7 +36,7 @@ Total number of frames: 3
|
||||
Frame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)
|
||||
Frame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)
|
||||
(jerry-debugger) n
|
||||
out: function foo
|
||||
function foo
|
||||
Stopped at tests/debugger/do_backtrace.js:24 (in foo() at line:21, col:1)
|
||||
(jerry-debugger) n
|
||||
Stopped at tests/debugger/do_backtrace.js:25 (in foo() at line:21, col:1)
|
||||
@@ -59,4 +59,4 @@ Frame 3: tests/debugger/do_backtrace.js:40
|
||||
(jerry-debugger) bt 4 3
|
||||
Error: Start depth needs to be lower than or equal to max depth
|
||||
(jerry-debugger) c
|
||||
out: function f4
|
||||
function f4
|
||||
|
||||
@@ -14,8 +14,8 @@ Breakpoint 4 at tests/debugger/do_break.js:45 (in f() at line:43, col:1)
|
||||
3: tests/debugger/do_break.js:33 (in f() at line:31, col:3)
|
||||
4: tests/debugger/do_break.js:45 (in f() at line:43, col:1)
|
||||
(jerry-debugger) c
|
||||
out: break test
|
||||
out: var cat
|
||||
break test
|
||||
var cat
|
||||
Stopped at breakpoint:1 tests/debugger/do_break.js:51
|
||||
(jerry-debugger) delete 1
|
||||
Breakpoint 1 deleted
|
||||
@@ -27,6 +27,6 @@ Breakpoint 1 deleted
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:2 tests/debugger/do_break.js:36 (in test() at line:20, col:1)
|
||||
(jerry-debugger) continue
|
||||
out: function test
|
||||
function test
|
||||
Stopped at breakpoint:3 tests/debugger/do_break.js:33 (in f() at line:31, col:3)
|
||||
(jerry-debugger) c
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_delete.js:15
|
||||
(jerry-debugger) next
|
||||
out: delete tests
|
||||
delete tests
|
||||
Stopped at tests/debugger/do_delete.js:17
|
||||
(jerry-debugger) b do_delete.js:17
|
||||
Breakpoint 1 at tests/debugger/do_delete.js:17
|
||||
|
||||
@@ -14,7 +14,7 @@ Non-negative integer number expected, 0 turns off this function
|
||||
Stopped at breakpoint:1 tests/debugger/do_display.js:15 (in a() at line:15, col:1)
|
||||
(jerry-debugger) display 2
|
||||
(jerry-debugger) c
|
||||
out: hi
|
||||
hi
|
||||
Stopped at breakpoint:2 tests/debugger/do_display.js:16 (in b() at line:16, col:1)
|
||||
Source: tests/debugger/do_display.js
|
||||
15 function a() { print("hi"); }
|
||||
@@ -22,7 +22,7 @@ Source: tests/debugger/do_display.js
|
||||
17 function c() { print("hello"); }
|
||||
(jerry-debugger) display 5435
|
||||
(jerry-debugger) c
|
||||
out: welcome
|
||||
welcome
|
||||
Stopped at breakpoint:3 tests/debugger/do_display.js:17 (in c() at line:17, col:1)
|
||||
Source: tests/debugger/do_display.js
|
||||
1 // Copyright JS Foundation and other contributors, http://js.foundation
|
||||
@@ -50,7 +50,7 @@ Source: tests/debugger/do_display.js
|
||||
23 d();
|
||||
(jerry-debugger) display 0
|
||||
(jerry-debugger) c
|
||||
out: hello
|
||||
hello
|
||||
Stopped at breakpoint:4 tests/debugger/do_display.js:18 (in d() at line:18, col:1)
|
||||
(jerry-debugger) c
|
||||
out: goodbye
|
||||
goodbye
|
||||
|
||||
@@ -5,4 +5,4 @@ Stopped at tests/debugger/do_eval_syntax.js:26
|
||||
(jerry-debugger) eval loop
|
||||
Uncaught exception: Error
|
||||
(jerry-debugger) c
|
||||
out: bar function
|
||||
bar function
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_exception.js:15
|
||||
(jerry-debugger) c
|
||||
out: exception handler configuration test
|
||||
exception handler configuration test
|
||||
Exception throw detected (to disable automatic stop type exception 0)
|
||||
Exception hint: TypeError
|
||||
Stopped around tests/debugger/do_exception.js:19 (in foo() at line:17, col:1)
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_finish.js:15
|
||||
(jerry-debugger) finish
|
||||
out: finish-test
|
||||
finish-test
|
||||
Stopped at tests/debugger/do_finish.js:26
|
||||
(jerry-debugger) finish
|
||||
Stopped at tests/debugger/do_finish.js:18 (in foo() at line:17, col:1)
|
||||
(jerry-debugger) finish
|
||||
out: foo
|
||||
out: bar
|
||||
foo
|
||||
bar
|
||||
Stopped at tests/debugger/do_finish.js:42
|
||||
(jerry-debugger) step
|
||||
Stopped at tests/debugger/do_finish.js:29 (in dog() at line:28, col:1)
|
||||
(jerry-debugger) finish
|
||||
out: *bark*
|
||||
out: *sit*
|
||||
out: *bark*
|
||||
*bark*
|
||||
*sit*
|
||||
*bark*
|
||||
Stopped at tests/debugger/do_finish.js:44
|
||||
(jerry-debugger) continue
|
||||
out: END: finish-test
|
||||
END: finish-test
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_next.js:15
|
||||
(jerry-debugger) next
|
||||
out: next test
|
||||
next test
|
||||
Stopped at tests/debugger/do_next.js:28
|
||||
(jerry-debugger) next
|
||||
out: Func
|
||||
Func
|
||||
Stopped at tests/debugger/do_next.js:30
|
||||
(jerry-debugger) n
|
||||
Stopped at tests/debugger/do_next.js:33
|
||||
(jerry-debugger) n
|
||||
out: Func
|
||||
Func
|
||||
Stopped at tests/debugger/do_next.js:35
|
||||
(jerry-debugger) next
|
||||
Stopped at tests/debugger/do_next.js:39
|
||||
|
||||
@@ -9,7 +9,7 @@ No breakpoint found, do you want to add a pending breakpoint? (y or [n]) Pending
|
||||
1: :1 (pending)
|
||||
2: f() (pending)
|
||||
(jerry-debugger) c
|
||||
out: pending-breakpoints
|
||||
pending-breakpoints
|
||||
Breakpoint 3 at <unknown>:1
|
||||
Breakpoint 4 at <unknown>:3 (in f() at line:2, col:1)
|
||||
Stopped at breakpoint:3 <unknown>:1
|
||||
|
||||
@@ -1,112 +1,22 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_print.js:15
|
||||
(jerry-debugger) c
|
||||
out: Hello world!
|
||||
out: A [ ] 110 null true undefined
|
||||
out:
|
||||
out: [A
|
||||
out: B C
|
||||
out: D E
|
||||
out: F
|
||||
out: G]
|
||||
out: 1: Az élet gyönyörű.
|
||||
out: 2: Az élet gyönyörű.
|
||||
out: 3: Az élet gyönyörű.
|
||||
out: 4: Az élet gyönyörű.
|
||||
out: 5: Az élet gyönyörű.
|
||||
out: 6: Az élet gyönyörű.
|
||||
out: 7: Az élet gyönyörű.
|
||||
out: 8: Az élet gyönyörű.
|
||||
out: 9: Az élet gyönyörű.
|
||||
out: 10: Az élet gyönyörű.
|
||||
out: 11: Az élet gyönyörű.
|
||||
out: 12: Az élet gyönyörű.
|
||||
out: 13: Az élet gyönyörű.
|
||||
out: 14: Az élet gyönyörű.
|
||||
out: 15: Az élet gyönyörű.
|
||||
out: 16: Az élet gyönyörű.
|
||||
out: 17: Az élet gyönyörű.
|
||||
out: 18: Az élet gyönyörű.
|
||||
out: 19: Az élet gyönyörű.
|
||||
out: 20: Az élet gyönyörű.
|
||||
out: 21: Az élet gyönyörű.
|
||||
out: 22: Az élet gyönyörű.
|
||||
out: 23: Az élet gyönyörű.
|
||||
out: 24: Az élet gyönyörű.
|
||||
out: 25: Az élet gyönyörű.
|
||||
out: 26: Az élet gyönyörű.
|
||||
out: 27: Az élet gyönyörű.
|
||||
out: 28: Az élet gyönyörű.
|
||||
out: 29: Az élet gyönyörű.
|
||||
out: 30: Az élet gyönyörű.
|
||||
out: 31: Az élet gyönyörű.
|
||||
out: 32: Az élet gyönyörű.
|
||||
out: 33: Az élet gyönyörű.
|
||||
out: 34: Az élet gyönyörű.
|
||||
out: 35: Az élet gyönyörű.
|
||||
out: 36: Az élet gyönyörű.
|
||||
out: 37: Az élet gyönyörű.
|
||||
out: 38: Az élet gyönyörű.
|
||||
out: 39: Az élet gyönyörű.
|
||||
out: 40: Az élet gyönyörű.
|
||||
out: 41: Az élet gyönyörű.
|
||||
out: 42: Az élet gyönyörű.
|
||||
out: 43: Az élet gyönyörű.
|
||||
out: 44: Az élet gyönyörű.
|
||||
out: 45: Az élet gyönyörű.
|
||||
out: 46: Az élet gyönyörű.
|
||||
out: 47: Az élet gyönyörű.
|
||||
out: 48: Az élet gyönyörű.
|
||||
out: 49: Az élet gyönyörű.
|
||||
out: 50: Az élet gyönyörű.
|
||||
out: 51: Az élet gyönyörű.
|
||||
out: 52: Az élet gyönyörű.
|
||||
out: 53: Az élet gyönyörű.
|
||||
out: 54: Az élet gyönyörű.
|
||||
out: 55: Az élet gyönyörű.
|
||||
out: 56: Az élet gyönyörű.
|
||||
out: 57: Az élet gyönyörű.
|
||||
out: 58: Az élet gyönyörű.
|
||||
out: 59: Az élet gyönyörű.
|
||||
out: 60: Az élet gyönyörű.
|
||||
out: 61: Az élet gyönyörű.
|
||||
out: 62: Az élet gyönyörű.
|
||||
out: 63: Az élet gyönyörű.
|
||||
out: 64: Az élet gyönyörű.
|
||||
out: 65: Az élet gyönyörű.
|
||||
out: 66: Az élet gyönyörű.
|
||||
out: 67: Az élet gyönyörű.
|
||||
out: 68: Az élet gyönyörű.
|
||||
out: 69: Az élet gyönyörű.
|
||||
out: 70: Az élet gyönyörű.
|
||||
out: 71: Az élet gyönyörű.
|
||||
out: 72: Az élet gyönyörű.
|
||||
out: 73: Az élet gyönyörű.
|
||||
out: 74: Az élet gyönyörű.
|
||||
out: 75: Az élet gyönyörű.
|
||||
out: 76: Az élet gyönyörű.
|
||||
out: 77: Az élet gyönyörű.
|
||||
out: 78: Az élet gyönyörű.
|
||||
out: 79: Az élet gyönyörű.
|
||||
out: 80: Az élet gyönyörű.
|
||||
out: 81: Az élet gyönyörű.
|
||||
out: 82: Az élet gyönyörű.
|
||||
out: 83: Az élet gyönyörű.
|
||||
out: 84: Az élet gyönyörű.
|
||||
out: 85: Az élet gyönyörű.
|
||||
out: 86: Az élet gyönyörű.
|
||||
out: 87: Az élet gyönyörű.
|
||||
out: 88: Az élet gyönyörű.
|
||||
out: 89: Az élet gyönyörű.
|
||||
out: 90: Az élet gyönyörű.
|
||||
out: 91: Az élet gyönyörű.
|
||||
out: 92: Az élet gyönyörű.
|
||||
out: 93: Az élet gyönyörű.
|
||||
out: 94: Az élet gyönyörű.
|
||||
out: 95: Az élet gyönyörű.
|
||||
out: 96: Az élet gyönyörű.
|
||||
out: 97: Az élet gyönyörű.
|
||||
out: 98: Az élet gyönyörű.
|
||||
out: 99: Az élet gyönyörű.
|
||||
out: 100: Az élet gyönyörű.
|
||||
out:
|
||||
Hello world!
|
||||
A [ ] 110 null true undefined
|
||||
|
||||
[A
|
||||
B C
|
||||
D E
|
||||
F
|
||||
G]
|
||||
1: Az élet gyönyörű.
|
||||
2: Az élet gyönyörű.
|
||||
3: Az élet gyönyörű.
|
||||
4: Az élet gyönyörű.
|
||||
5: Az élet gyönyörű.
|
||||
6: Az élet gyönyörű.
|
||||
7: Az élet gyönyörű.
|
||||
8: Az élet gyönyörű.
|
||||
9: Az élet gyönyörű.
|
||||
10: Az élet gyönyörű.
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ print("[A\nB", "C\nD", "E\nF\nG]");
|
||||
|
||||
var s = "";
|
||||
|
||||
for (i = 1; i <= 100; i++) {
|
||||
for (i = 1; i <= 10; i++) {
|
||||
/* Translated from hungarian: life is beautiful */
|
||||
s += i + ": Az élet gyönyörű.\n";
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@ Stopped at tests/debugger/do_restart.js:23
|
||||
(jerry-debugger) n
|
||||
Stopped at tests/debugger/do_restart.js:24
|
||||
(jerry-debugger) n
|
||||
out: foo
|
||||
foo
|
||||
Stopped at tests/debugger/do_restart.js:25
|
||||
(jerry-debugger) n
|
||||
out: bar
|
||||
bar
|
||||
Stopped at tests/debugger/do_restart.js:24
|
||||
(jerry-debugger) restart
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_restart.js:23
|
||||
(jerry-debugger) continue
|
||||
out: foo
|
||||
out: bar
|
||||
out: foo
|
||||
out: bar
|
||||
foo
|
||||
bar
|
||||
foo
|
||||
bar
|
||||
|
||||
@@ -5,7 +5,7 @@ Breakpoint 1 at tests/debugger/do_src.js:16 (in f() at line:15, col:1)
|
||||
(jerry-debugger) n
|
||||
Stopped at breakpoint:1 tests/debugger/do_src.js:16 (in f() at line:15, col:1)
|
||||
(jerry-debugger) next
|
||||
out: F1
|
||||
F1
|
||||
Stopped at tests/debugger/do_src.js:20
|
||||
(jerry-debugger) s
|
||||
Stopped at <unknown>:1
|
||||
@@ -20,4 +20,4 @@ Stopped at <unknown>:2 (in f() at line:1, col:5)
|
||||
1 f = function f() {
|
||||
2 > print('F2') }
|
||||
(jerry-debugger) c
|
||||
out: F2
|
||||
F2
|
||||
|
||||
@@ -17,4 +17,4 @@ Stopped at tests/debugger/do_throw.js:34
|
||||
(jerry-debugger) eval e.message.length
|
||||
538
|
||||
(jerry-debugger) throw new Error('Exit')
|
||||
err: Unhandled exception: Error: Exit
|
||||
Unhandled exception: Error: Exit
|
||||
|
||||
@@ -39,4 +39,4 @@ Exception throw detected (to disable automatic stop type exception 0)
|
||||
Exception hint: 16
|
||||
Stopped at tests/debugger/do_throw_adv.js:18 (in f() at line:17, col:1)
|
||||
(jerry-debugger) c
|
||||
err: Unhandled exception: 16
|
||||
Unhandled exception: 16
|
||||
|
||||
@@ -43,7 +43,7 @@ assert (d.getDate() == 9);
|
||||
assert (d.getUTCDate() == 9);
|
||||
assert (d.getDay() == 4);
|
||||
assert (d.getUTCDay() == 4);
|
||||
assert (d.getHours() == Math.floor(12 - 1.5 + d.getTimezoneOffset() / 60));
|
||||
assert (d.getHours() == Math.floor(12 - 1.5 - d.getTimezoneOffset() / 60));
|
||||
assert (d.getUTCHours() == Math.floor(12 - 1.5));
|
||||
assert (d.getMinutes() == 43);
|
||||
assert (d.getUTCMinutes() == 43);
|
||||
|
||||
@@ -58,8 +58,9 @@ catch (e)
|
||||
|
||||
assert (new Date (NaN).toTimeString () == "Invalid Date");
|
||||
assert (new Date (Number.POSITIVE_INFINITY).toString () === "Invalid Date");
|
||||
assert (new Date ("2015-02-13").toTimeString () == "00:00:00 GMT+0000");
|
||||
assert (new Date ("2015-07-08T11:29:05.023").toTimeString () == "11:29:05 GMT+0000");
|
||||
assert (new Date ("2015-02-13").toGMTString () == "Fri, 13 Feb 2015 00:00:00 GMT");
|
||||
assert (new Date ("2015-07-08T11:29:05.023+01:00").toGMTString () == "Wed, 08 Jul 2015 10:29:05 GMT");
|
||||
assert (new Date ("2015-07-08T11:29:05.023+10:00").toGMTString () == "Wed, 08 Jul 2015 01:29:05 GMT");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -72,7 +73,7 @@ catch (e)
|
||||
}
|
||||
|
||||
assert (new Date ("2015-07-16").toISOString () == "2015-07-16T00:00:00.000Z");
|
||||
assert (new Date ("2015-07-16T11:29:05.023").toISOString () == "2015-07-16T11:29:05.023Z");
|
||||
assert (new Date ("2015-07-16T11:29:05.023+00:00").toISOString () == "2015-07-16T11:29:05.023Z");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -106,7 +107,7 @@ catch (e)
|
||||
|
||||
assert (new Date (NaN).toUTCString () == "Invalid Date");
|
||||
assert (new Date ("2015-07-16").toUTCString () == "Thu, 16 Jul 2015 00:00:00 GMT");
|
||||
assert (new Date ("2015-07-16T11:29:05.023").toUTCString () == "Thu, 16 Jul 2015 11:29:05 GMT");
|
||||
assert (new Date ("2015-07-16T11:29:05.023+00:00").toUTCString () == "Thu, 16 Jul 2015 11:29:05 GMT");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -120,7 +121,7 @@ catch (e)
|
||||
|
||||
assert (new Date (NaN).toJSON () == null);
|
||||
assert (new Date ("2015-07-16").toJSON () == "2015-07-16T00:00:00.000Z");
|
||||
assert (new Date ("2015-07-16T11:29:05.023").toJSON () == "2015-07-16T11:29:05.023Z");
|
||||
assert (new Date ("2015-07-16T11:29:05.023+00:00").toJSON () == "2015-07-16T11:29:05.023Z");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -132,7 +133,7 @@ catch (e)
|
||||
assert (e instanceof TypeError);
|
||||
}
|
||||
|
||||
date_time = new Date ("2015-07-08T11:29:05.023").toJSON ();
|
||||
date_time = new Date ("2015-07-08T11:29:05.023+00:00").toJSON ();
|
||||
assert (new Date (date_time).toISOString () == "2015-07-08T11:29:05.023Z");
|
||||
|
||||
assert (typeof Date (2015) == "string");
|
||||
@@ -145,26 +146,26 @@ assert (new Date ("2015-07-08T11:29:05.023Z").toISOString() == "2015-07-08T11:29
|
||||
|
||||
// corner cases
|
||||
assert (new Date (-8640000000000001).toString() == "Invalid Date")
|
||||
assert (new Date (-8640000000000000).toString() == "Tue Apr 20 -271821 00:00:00 GMT+0000")
|
||||
assert (new Date (-8640000000000000).toGMTString() == "Tue, 20 Apr -271821 00:00:00 GMT")
|
||||
|
||||
assert (new Date(-62167219200001).toString() == "Fri Dec 31 -0001 23:59:59 GMT+0000")
|
||||
assert (new Date(-62167219200000).toString() == "Sat Jan 01 0000 00:00:00 GMT+0000")
|
||||
assert (new Date(-62167219200001).toGMTString() == "Fri, 31 Dec -0001 23:59:59 GMT")
|
||||
assert (new Date(-62167219200000).toGMTString() == "Sat, 01 Jan 0000 00:00:00 GMT")
|
||||
|
||||
assert (new Date(-61851600000001).toString() == "Thu Dec 31 0009 23:59:59 GMT+0000")
|
||||
assert (new Date(-61851600000000).toString() == "Fri Jan 01 0010 00:00:00 GMT+0000")
|
||||
assert (new Date(-61851600000001).toGMTString() == "Thu, 31 Dec 0009 23:59:59 GMT")
|
||||
assert (new Date(-61851600000000).toGMTString() == "Fri, 01 Jan 0010 00:00:00 GMT")
|
||||
|
||||
assert (new Date(-59011459200001).toString() == "Thu Dec 31 0099 23:59:59 GMT+0000")
|
||||
assert (new Date(-59011459200000).toString() == "Fri Jan 01 0100 00:00:00 GMT+0000")
|
||||
assert (new Date(-59011459200001).toGMTString() == "Thu, 31 Dec 0099 23:59:59 GMT")
|
||||
assert (new Date(-59011459200000).toGMTString() == "Fri, 01 Jan 0100 00:00:00 GMT")
|
||||
|
||||
assert (new Date(-30610224000001).toString() == "Tue Dec 31 0999 23:59:59 GMT+0000")
|
||||
assert (new Date(-30610224000000).toString() == "Wed Jan 01 1000 00:00:00 GMT+0000")
|
||||
assert (new Date(-30610224000001).toGMTString() == "Tue, 31 Dec 0999 23:59:59 GMT")
|
||||
assert (new Date(-30610224000000).toGMTString() == "Wed, 01 Jan 1000 00:00:00 GMT")
|
||||
|
||||
assert (new Date(-1).toString() == "Wed Dec 31 1969 23:59:59 GMT+0000")
|
||||
assert (new Date(0).toString() == "Thu Jan 01 1970 00:00:00 GMT+0000")
|
||||
assert (new Date(1).toString() == "Thu Jan 01 1970 00:00:00 GMT+0000")
|
||||
assert (new Date(-1).toGMTString() == "Wed, 31 Dec 1969 23:59:59 GMT")
|
||||
assert (new Date(0).toGMTString() == "Thu, 01 Jan 1970 00:00:00 GMT")
|
||||
assert (new Date(1).toGMTString() == "Thu, 01 Jan 1970 00:00:00 GMT")
|
||||
|
||||
assert (new Date(253402300799999).toString() == "Fri Dec 31 9999 23:59:59 GMT+0000")
|
||||
assert (new Date(253402300800000).toString() == "Sat Jan 01 10000 00:00:00 GMT+0000")
|
||||
assert (new Date(253402300799999).toGMTString() == "Fri, 31 Dec 9999 23:59:59 GMT")
|
||||
assert (new Date(253402300800000).toGMTString() == "Sat, 01 Jan 10000 00:00:00 GMT")
|
||||
|
||||
assert (new Date (8640000000000000).toString() == "Sat Sep 13 275760 00:00:00 GMT+0000")
|
||||
assert (new Date (8640000000000001).toString() == "Invalid Date")
|
||||
assert (new Date (8640000000000000).toGMTString() == "Sat, 13 Sep 275760 00:00:00 GMT")
|
||||
assert (new Date (8640000000000001).toGMTString() == "Invalid Date")
|
||||
|
||||
@@ -113,7 +113,7 @@ foreach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_CORE_PRIVATE})
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "${LINKER_FLAGS_COMMON}")
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
|
||||
target_link_libraries(${TARGET_NAME} jerry-core jerry-port-default)
|
||||
target_link_libraries(${TARGET_NAME} jerry-core jerry-port)
|
||||
|
||||
add_dependencies(unittests-core ${TARGET_NAME})
|
||||
endforeach()
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -184,7 +183,7 @@ main (void)
|
||||
{
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_PROMISE))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Promise is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Promise is disabled!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -207,7 +206,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_TYPEDARRAY))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "ArrayBuffer is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "ArrayBuffer is disabled!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ main (void)
|
||||
{
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_BIGINT))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Bigint support is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Bigint support is disabled!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,53 +27,53 @@
|
||||
|
||||
#define JERRY_UNUSED(x) ((void) (x))
|
||||
|
||||
#define TEST_ASSERT(x) \
|
||||
do \
|
||||
{ \
|
||||
if (JERRY_UNLIKELY (!(x))) \
|
||||
{ \
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
|
||||
"TEST: Assertion '%s' failed at %s(%s):%lu.\n", \
|
||||
#x, \
|
||||
__FILE__, \
|
||||
__func__, \
|
||||
(unsigned long) __LINE__); \
|
||||
jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
|
||||
} \
|
||||
#define TEST_ASSERT(x) \
|
||||
do \
|
||||
{ \
|
||||
if (JERRY_UNLIKELY (!(x))) \
|
||||
{ \
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, \
|
||||
"TEST: Assertion '%s' failed at %s(%s):%lu.\n", \
|
||||
#x, \
|
||||
__FILE__, \
|
||||
__func__, \
|
||||
(unsigned long) __LINE__); \
|
||||
jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define TEST_ASSERT_STR(EXPECTED, RESULT) \
|
||||
do \
|
||||
{ \
|
||||
const char* __expected = (const char*) (EXPECTED); \
|
||||
const char* __result = (const char*) (RESULT); \
|
||||
if (strcmp (__expected, __result) != 0) \
|
||||
{ \
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
|
||||
"TEST: String comparison failed at %s(%s):%lu.\n" \
|
||||
" Expected: '%s'\n Got: '%s'\n", \
|
||||
__FILE__, \
|
||||
__func__, \
|
||||
(unsigned long) __LINE__, \
|
||||
__expected, \
|
||||
__result); \
|
||||
jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
|
||||
} \
|
||||
#define TEST_ASSERT_STR(EXPECTED, RESULT) \
|
||||
do \
|
||||
{ \
|
||||
const char* __expected = (const char*) (EXPECTED); \
|
||||
const char* __result = (const char*) (RESULT); \
|
||||
if (strcmp (__expected, __result) != 0) \
|
||||
{ \
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, \
|
||||
"TEST: String comparison failed at %s(%s):%lu.\n" \
|
||||
" Expected: '%s'\n Got: '%s'\n", \
|
||||
__FILE__, \
|
||||
__func__, \
|
||||
(unsigned long) __LINE__, \
|
||||
__expected, \
|
||||
__result); \
|
||||
jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Test initialization statement that should be included
|
||||
* at the beginning of main function in every unit test.
|
||||
*/
|
||||
#define TEST_INIT() \
|
||||
do \
|
||||
{ \
|
||||
union \
|
||||
{ \
|
||||
double d; \
|
||||
unsigned u; \
|
||||
} now = { .d = jerry_port_get_current_time () }; \
|
||||
srand (now.u); \
|
||||
#define TEST_INIT() \
|
||||
do \
|
||||
{ \
|
||||
union \
|
||||
{ \
|
||||
double d; \
|
||||
unsigned u; \
|
||||
} now = { .d = jerry_port_current_time () }; \
|
||||
srand (now.u); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ main (void)
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_MAP) || !jerry_feature_enabled (JERRY_FEATURE_SET)
|
||||
|| !jerry_feature_enabled (JERRY_FEATURE_WEAKMAP) || !jerry_feature_enabled (JERRY_FEATURE_WEAKSET))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Containers are disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Containers are disabled!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ main (void)
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_MAP) || !jerry_feature_enabled (JERRY_FEATURE_SET)
|
||||
|| !jerry_feature_enabled (JERRY_FEATURE_WEAKMAP) || !jerry_feature_enabled (JERRY_FEATURE_WEAKSET))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Containers are disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Containers are disabled!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -24,7 +23,7 @@ main (void)
|
||||
{
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_DATAVIEW))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "DataView support is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "DataView support is disabled!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -192,7 +191,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_MODULE))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Module is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Module is disabled!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_MODULE))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Module is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Module is disabled!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_MODULE))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Module is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Module is disabled!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -48,18 +47,9 @@ static const jerry_object_native_info_t native_info = {
|
||||
.offset_of_references = 0,
|
||||
};
|
||||
|
||||
static void *
|
||||
context_alloc_fn (size_t size, void *cb_data)
|
||||
{
|
||||
(void) cb_data;
|
||||
return malloc (size);
|
||||
} /* context_alloc_fn */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
jerry_context_t *ctx_p = jerry_context_alloc (1024, context_alloc_fn, NULL);
|
||||
jerry_port_default_set_current_context (ctx_p);
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
jerry_value_t obj = jerry_object ();
|
||||
@@ -68,6 +58,5 @@ main (void)
|
||||
jerry_value_free (obj);
|
||||
|
||||
jerry_cleanup ();
|
||||
free (ctx_p);
|
||||
return 0;
|
||||
} /* main */
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -112,7 +111,7 @@ main (void)
|
||||
/* Test JERRY_FEATURE_SYMBOL feature as it is a must-have in ES.next */
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_SYMBOL))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Skipping test, ES.next support is disabled.\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Skipping test, ES.next support is disabled.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ test_container (void)
|
||||
/* If there is no Map function this is not an es.next profile build, skip this test case. */
|
||||
if (type != JERRY_TYPE_FUNCTION)
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Container based test is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Container based test is disabled!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_PROMISE))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Promise is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Promise is disabled!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -110,7 +109,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_PROMISE))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Promise is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Promise is disabled!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_SYMBOL))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "ES.next support is disabled\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "ES.next support is disabled\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -41,7 +40,7 @@ main (void)
|
||||
/* Test JERRY_FEATURE_SYMBOL feature as it is a must-have in ES.next */
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_SYMBOL))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Skipping test, ES.next support is disabled.\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Skipping test, ES.next support is disabled.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_FUNCTION_TO_STRING))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Source code is not stored!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Source code is not stored!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_LINE_INFO))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Line info support is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Line info support is disabled!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -36,7 +35,7 @@ main (void)
|
||||
{
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_SYMBOL))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Symbol support is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "Symbol support is disabled!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "jerryscript-port-default.h"
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript.h"
|
||||
|
||||
@@ -570,7 +569,7 @@ main (void)
|
||||
|
||||
if (!jerry_feature_enabled (JERRY_FEATURE_TYPEDARRAY))
|
||||
{
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "TypedArray is disabled!\n");
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, "TypedArray is disabled!\n");
|
||||
jerry_cleanup ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ add_custom_target(all-doc-files DEPENDS ${DOCTEST_COMPILE} ${DOCTEST_LINK} ${DOC
|
||||
if(NOT ("${DOCTEST_COMPILE}" STREQUAL ""))
|
||||
add_library(compile-doc-tests ${DOCTEST_COMPILE})
|
||||
add_dependencies(compile-doc-tests all-doc-files)
|
||||
target_link_libraries(compile-doc-tests jerry-ext jerry-core jerry-port-default)
|
||||
target_link_libraries(compile-doc-tests jerry-ext jerry-core jerry-port)
|
||||
set_property(TARGET compile-doc-tests APPEND_STRING PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_DOCTEST}")
|
||||
endif()
|
||||
|
||||
@@ -115,7 +115,7 @@ macro(doctest_add_executables NAME_PREFIX)
|
||||
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_DOCTEST}")
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "${LINKER_FLAGS_COMMON}")
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
|
||||
target_link_libraries(${TARGET_NAME} jerry-ext jerry-core jerry-port-default)
|
||||
target_link_libraries(${TARGET_NAME} jerry-ext jerry-core jerry-port)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ foreach(SOURCE_UNIT_TEST_EXT ${SOURCE_UNIT_TEST_EXT_MODULES})
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "${LINKER_FLAGS_COMMON}")
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} jerry-ext jerry-core jerry-port-default)
|
||||
target_link_libraries(${TARGET_NAME} jerry-ext jerry-core jerry-port)
|
||||
|
||||
add_dependencies(unittests-ext ${TARGET_NAME})
|
||||
endforeach()
|
||||
|
||||
@@ -29,5 +29,5 @@ endif()
|
||||
add_executable(${JERRYX_MODULE_UNITTEST_NAME} ${JERRYX_MODULE_UNIT_TEST_SOURCES})
|
||||
set_property(TARGET ${JERRYX_MODULE_UNITTEST_NAME} PROPERTY LINK_FLAGS "${LINKER_FLAGS_COMMON}")
|
||||
set_property(TARGET ${JERRYX_MODULE_UNITTEST_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
|
||||
target_link_libraries(${JERRYX_MODULE_UNITTEST_NAME} jerry-ext jerry-core jerry-port-default)
|
||||
target_link_libraries(${JERRYX_MODULE_UNITTEST_NAME} jerry-ext jerry-core jerry-port)
|
||||
target_include_directories(${JERRYX_MODULE_UNITTEST_NAME} PRIVATE ${INCLUDE_UNIT_EXT})
|
||||
|
||||
@@ -22,19 +22,19 @@
|
||||
|
||||
#define JERRY_UNUSED(x) ((void) (x))
|
||||
|
||||
#define TEST_ASSERT(x) \
|
||||
do \
|
||||
{ \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
|
||||
"TEST: Assertion '%s' failed at %s(%s):%lu.\n", \
|
||||
#x, \
|
||||
__FILE__, \
|
||||
__func__, \
|
||||
(unsigned long) __LINE__); \
|
||||
jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
|
||||
} \
|
||||
#define TEST_ASSERT(x) \
|
||||
do \
|
||||
{ \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
jerry_log (JERRY_LOG_LEVEL_ERROR, \
|
||||
"TEST: Assertion '%s' failed at %s(%s):%lu.\n", \
|
||||
#x, \
|
||||
__FILE__, \
|
||||
__func__, \
|
||||
(unsigned long) __LINE__); \
|
||||
jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define TEST_STRING_LITERAL(x) x
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "jerryscript.h"
|
||||
|
||||
#include "jerryscript-ext/handler.h"
|
||||
#include "jerryscript-ext/properties.h"
|
||||
#include "test-common.h"
|
||||
|
||||
static jerry_value_t
|
||||
@@ -81,7 +81,7 @@ test_simple_registration (void)
|
||||
jerry_value_free (register_result.result);
|
||||
|
||||
jerry_value_t global_obj = jerry_current_realm ();
|
||||
jerryx_set_property_str (global_obj, "test", target_object);
|
||||
jerry_object_set_sz (global_obj, "test", target_object);
|
||||
jerry_value_free (target_object);
|
||||
jerry_value_free (global_obj);
|
||||
|
||||
@@ -167,7 +167,7 @@ test_error_setvalue (void)
|
||||
freeze_property (global_obj, target_prop);
|
||||
|
||||
jerry_value_t new_object = jerry_object ();
|
||||
jerry_value_t set_result = jerryx_set_property_str (global_obj, target_prop, new_object);
|
||||
jerry_value_t set_result = jerry_object_set_sz (global_obj, target_prop, new_object);
|
||||
TEST_ASSERT (jerry_value_is_exception (set_result));
|
||||
|
||||
jerry_value_free (set_result);
|
||||
|
||||
Reference in New Issue
Block a user