diff options
author | Mohammad Sulaiman <mohammad.sulaiman@exalt.ps> | 2024-10-15 01:04:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-14 15:04:18 -0700 |
commit | 8dbe77dd29a3791db58fda392dea45d8249b6bc9 (patch) | |
tree | 1fb57b9d4cbad21455afee71937a17ab6804315c /tests/specs | |
parent | 48cbf85add1a9a5c3e583c68c80d16420e606502 (diff) |
fix(console/ext/repl): support using parseFloat() (#25900)
Fixes #21428
Co-authored-by: tannal <tannal2409@gmail.com>
Diffstat (limited to 'tests/specs')
-rw-r--r-- | tests/specs/repl/console_log/093_console_log_format.js | 16 | ||||
-rw-r--r-- | tests/specs/repl/console_log/093_console_log_format.out | 1 | ||||
-rw-r--r-- | tests/specs/repl/console_log/__test__.jsonc | 4 |
3 files changed, 21 insertions, 0 deletions
diff --git a/tests/specs/repl/console_log/093_console_log_format.js b/tests/specs/repl/console_log/093_console_log_format.js new file mode 100644 index 000000000..15022411c --- /dev/null +++ b/tests/specs/repl/console_log/093_console_log_format.js @@ -0,0 +1,16 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +class Frac { + constructor(num, den) { + this.num = num; + this.den = den; + } + [Symbol.toPrimitive]() { + return this.num / this.den; + } + display() { + const result = this.num / this.den; + process.stdout.write(`${result}`); + } +} +const f = new Frac(1, 2); +f.display(); diff --git a/tests/specs/repl/console_log/093_console_log_format.out b/tests/specs/repl/console_log/093_console_log_format.out new file mode 100644 index 000000000..ea2303bc0 --- /dev/null +++ b/tests/specs/repl/console_log/093_console_log_format.out @@ -0,0 +1 @@ +0.5
\ No newline at end of file diff --git a/tests/specs/repl/console_log/__test__.jsonc b/tests/specs/repl/console_log/__test__.jsonc new file mode 100644 index 000000000..641bc1f68 --- /dev/null +++ b/tests/specs/repl/console_log/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run -A --quiet 093_console_log_format.js", + "output": "093_console_log_format.out" +} |