8000 util, refactor: fix symbol formatting in util_format. · fibjs/fibjs@bca8c1f · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit bca8c1f

Browse files
committed
util, refactor: fix symbol formatting in util_format.
1 parent a760a35 commit bca8c1f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

fibjs/src/util/util_format.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ void symbol_format(Isolate* isolate, StringBuffer& strBuffer, v8::Local<v8::Valu
9090

9191
void key_format(Isolate* isolate, StringBuffer& strBuffer, v8::Local<v8::Value> v, bool color)
9292
{
93-
if (v->IsSymbol())
93+
if (v->IsSymbol()) {
94+
strBuffer.append("[");
9495
symbol_format(isolate, strBuffer, v, color);
95-
else
96+
strBuffer.append("]");
97+
} else
9698
string_format(isolate, strBuffer, v);
9799
}
98100

test/util_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ describe('util', () => {
851851
assert.equal(util.format(Symbol('debug')), 'Symbol(debug)');
852852
const o = {};
853853
o[Symbol('debug')] = 100;
854-
assert.equal(util.format(o), '{\n Symbol(debug): 100\n}');
854+
assert.equal(util.format(o), '{\n [Symbol(debug)]: 100\n}');
855855
});
856856

857857
it("Error", () => {

0 commit comments

Comments
 (0)
0