-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Update test runner output with colors and diffs #2122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a839803
68400cb
0009f0b
c663c83
2b5908c
d745ce1
f973cd8
926731a
f30d25f
4f320f5
cc777d4
e652b29
6bfdee0
625a2da
60c7499
ca62275
aa519f5
8f1aca6
a5970e8
1abb9bd
dcccbdb
45f0f9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,27 +97,23 @@ static void copyToUWS(WebCore::FetchHeaders* headers, UWSResponse* res) | |
| auto& internalHeaders = headers->internalHeaders(); | ||
|
|
||
| for (auto& value : internalHeaders.getSetCookieHeaders()) { | ||
| res->writeHeader(std::string_view("set-cookie", 10), std::string_view( | ||
| value.is8Bit() ? reinterpret_cast<const char*>(value.characters8()) : value.utf8().data(), value.length() | ||
| )); | ||
| res->writeHeader(std::string_view("set-cookie", 10), std::string_view(value.is8Bit() ? reinterpret_cast<const char*>(value.characters8()) : value.utf8().data(), value.length())); | ||
| } | ||
|
|
||
| for (auto& header : internalHeaders.commonHeaders()) { | ||
| const auto& name = WebCore::httpHeaderNameString(header.key); | ||
| auto& value = header.value; | ||
| res->writeHeader( | ||
| std::string_view(name.is8Bit() ? reinterpret_cast<const char*>(name.characters8()) : name.utf8().data(), name.length()), | ||
| std::string_view(value.is8Bit() ? reinterpret_cast<const char*>(value.characters8()) : value.utf8().data(), value.length()) | ||
| ); | ||
| std::string_view(value.is8Bit() ? reinterpret_cast<const char*>(value.characters8()) : value.utf8().data(), value.length())); | ||
| } | ||
|
|
||
| for (auto& header : internalHeaders.uncommonHeaders()) { | ||
| auto& name = header.key; | ||
| auto& value = header.value; | ||
| res->writeHeader( | ||
| std::string_view(name.is8Bit() ? reinterpret_cast<const char*>(name.characters8()) : name.utf8().data(), name.length()), | ||
| std::string_view(value.is8Bit() ? reinterpret_cast<const char*>(value.characters8()) : value.utf8().data(), value.length()) | ||
| ); | ||
| std::string_view(value.is8Bit() ? reinterpret_cast<const char*>(value.characters8()) : value.utf8().data(), value.length())); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -718,12 +714,11 @@ WebCore__FetchHeaders* WebCore__FetchHeaders__createEmpty() | |
| return new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); | ||
| } | ||
| void WebCore__FetchHeaders__append(WebCore__FetchHeaders* headers, const ZigString* arg1, const ZigString* arg2, | ||
| JSC__JSGlobalObject* lexicalGlobalObject) | ||
| JSC__JSGlobalObject* lexicalGlobalObject) | ||
| { | ||
| auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject->vm()); | ||
| WebCore::propagateException(*lexicalGlobalObject, throwScope, | ||
| headers->append(Zig::toString(*arg1), Zig::toString(*arg2)) | ||
| ); | ||
| headers->append(Zig::toString(*arg1), Zig::toString(*arg2))); | ||
| } | ||
| WebCore__FetchHeaders* WebCore__FetchHeaders__cast_(JSC__JSValue JSValue0, JSC__VM* vm) | ||
| { | ||
|
|
@@ -752,8 +747,7 @@ WebCore__FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC__JSGlobalObject* | |
| // ExceptionOr<void>. So we need to check for the exception and, if set, | ||
| // translate it to JSValue and throw it. | ||
| WebCore::propagateException(*lexicalGlobalObject, throwScope, | ||
| headers->fill(WTFMove(init.value())) | ||
| ); | ||
| headers->fill(WTFMove(init.value()))); | ||
| } | ||
| return headers; | ||
| } | ||
|
|
@@ -770,8 +764,7 @@ JSC__JSValue WebCore__FetchHeaders__clone(WebCore__FetchHeaders* headers, JSC__J | |
| Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(arg1); | ||
| auto* clone = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); | ||
| WebCore::propagateException(*arg1, throwScope, | ||
| clone->fill(*headers) | ||
| ); | ||
| clone->fill(*headers)); | ||
| return JSC::JSValue::encode(WebCore::toJSNewlyCreated(arg1, globalObject, WTFMove(clone))); | ||
| } | ||
|
|
||
|
|
@@ -780,8 +773,7 @@ WebCore__FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore__FetchHeaders* h | |
| auto throwScope = DECLARE_THROW_SCOPE(lexicalGlobalObject->vm()); | ||
| auto* clone = new WebCore::FetchHeaders({ WebCore::FetchHeaders::Guard::None, {} }); | ||
| WebCore::propagateException(*lexicalGlobalObject, throwScope, | ||
| clone->fill(*headers) | ||
| ); | ||
| clone->fill(*headers)); | ||
| return clone; | ||
| } | ||
|
|
||
|
|
@@ -936,9 +928,8 @@ JSC__JSValue WebCore__FetchHeaders__createValue(JSC__JSGlobalObject* arg0, Strin | |
| } | ||
|
|
||
| Ref<WebCore::FetchHeaders> headers = WebCore::FetchHeaders::create(); | ||
| WebCore::propagateException(*arg0, throwScope, | ||
| headers->fill(WebCore::FetchHeaders::Init(WTFMove(pairs))) | ||
| ); | ||
| WebCore::propagateException(*arg0, throwScope, | ||
| headers->fill(WebCore::FetchHeaders::Init(WTFMove(pairs)))); | ||
| pairs.releaseBuffer(); | ||
| return JSC::JSValue::encode(WebCore::toJSNewlyCreated(arg0, reinterpret_cast<Zig::GlobalObject*>(arg0), WTFMove(headers))); | ||
| } | ||
|
|
@@ -965,15 +956,13 @@ void WebCore__FetchHeaders__put_(WebCore__FetchHeaders* headers, const ZigString | |
| { | ||
| auto throwScope = DECLARE_THROW_SCOPE(global->vm()); | ||
| WebCore::propagateException(*global, throwScope, | ||
| headers->set(Zig::toString(*arg1), Zig::toString(*arg2)) | ||
| ); | ||
| headers->set(Zig::toString(*arg1), Zig::toString(*arg2))); | ||
| } | ||
| void WebCore__FetchHeaders__remove(WebCore__FetchHeaders* headers, const ZigString* arg1, JSC__JSGlobalObject* global) | ||
| { | ||
| auto throwScope = DECLARE_THROW_SCOPE(global->vm()); | ||
| WebCore::propagateException(*global, throwScope, | ||
| headers->remove(Zig::toString(*arg1)) | ||
| ); | ||
| headers->remove(Zig::toString(*arg1))); | ||
| } | ||
|
|
||
| void WebCore__FetchHeaders__fastRemove_(WebCore__FetchHeaders* headers, unsigned char headerName) | ||
|
|
@@ -3762,6 +3751,40 @@ void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* g | |
| } | ||
| } | ||
|
|
||
| inline bool propertyCompare(const std::pair<String, JSValue>& a, const std::pair<String, JSValue>& b) | ||
| { | ||
| return codePointCompare(a.first.impl(), b.first.impl()) < 0; | ||
| } | ||
|
|
||
| void JSC__JSValue__forEachPropertyOrdered(JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, void* arg2, void (*iter)(JSC__JSGlobalObject* arg0, void* ctx, ZigString* arg2, JSC__JSValue JSValue3, bool isSymbol)) | ||
| { | ||
| JSC::JSValue value = JSC::JSValue::decode(JSValue0); | ||
| JSC::JSObject* object = value.getObject(); | ||
| if (!object) | ||
| return; | ||
|
|
||
| JSC::VM& vm = globalObject->vm(); | ||
| auto scope = DECLARE_CATCH_SCOPE(vm); | ||
|
|
||
| JSC::PropertyNameArray properties(vm, PropertyNameMode::StringsAndSymbols, PrivateSymbolMode::Exclude); | ||
| JSC::JSObject::getOwnPropertyNames(object, globalObject, properties, DontEnumPropertiesMode::Include); | ||
|
|
||
| Vector<std::pair<String, JSValue>> ordered_properties; | ||
| for (auto property : properties) { | ||
| JSValue propertyValue = object->getDirect(vm, property); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this correct? we don't want to call getters or prototype values? what happens if you pass it a Response subclass? |
||
| ordered_properties.append(std::pair<String, JSValue>(property.isSymbol() && !property.isPrivateName() ? property.impl() : property.string(), propertyValue)); | ||
| } | ||
|
|
||
| std::sort(ordered_properties.begin(), ordered_properties.end(), propertyCompare); | ||
|
|
||
| for (auto item : ordered_properties) { | ||
| ZigString key = toZigString(item.first); | ||
| JSValue propertyValue = item.second; | ||
| JSC::EnsureStillAliveScope ensureStillAliveScope(propertyValue); | ||
| iter(globalObject, arg2, &key, JSC::JSValue::encode(propertyValue), propertyValue.isSymbol()); | ||
| } | ||
| } | ||
|
|
||
| extern "C" JSC__JSValue JSC__JSValue__createRopeString(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject) | ||
| { | ||
| return JSValue::encode(JSC::jsString(globalObject, JSC::JSValue::decode(JSValue0).toString(globalObject), JSC::JSValue::decode(JSValue1).toString(globalObject))); | ||
|
|
@@ -3796,39 +3819,44 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC__JSGlobalObject* arg0 | |
| JSC::JSValue::decode(JSValue4)); | ||
| } | ||
|
|
||
| extern "C" JSC__AbortSignal* JSC__AbortSignal__signal(JSC__AbortSignal* arg0, JSC__JSValue JSValue1) { | ||
| extern "C" JSC__AbortSignal* JSC__AbortSignal__signal(JSC__AbortSignal* arg0, JSC__JSValue JSValue1) | ||
| { | ||
| WebCore::AbortSignal* abortSignal = reinterpret_cast<WebCore::AbortSignal*>(arg0); | ||
| abortSignal->signalAbort(JSC::JSValue::decode(JSValue1)); | ||
| return arg0; | ||
| } | ||
|
|
||
| extern "C" bool JSC__AbortSignal__aborted(JSC__AbortSignal* arg0) { | ||
| extern "C" bool JSC__AbortSignal__aborted(JSC__AbortSignal* arg0) | ||
| { | ||
| WebCore::AbortSignal* abortSignal = reinterpret_cast<WebCore::AbortSignal*>(arg0); | ||
| return abortSignal->aborted(); | ||
| } | ||
|
|
||
| extern "C" JSC__JSValue JSC__AbortSignal__abortReason(JSC__AbortSignal* arg0) { | ||
| extern "C" JSC__JSValue JSC__AbortSignal__abortReason(JSC__AbortSignal* arg0) | ||
| { | ||
| WebCore::AbortSignal* abortSignal = reinterpret_cast<WebCore::AbortSignal*>(arg0); | ||
| return JSC::JSValue::encode(abortSignal->reason().getValue()); | ||
| } | ||
|
|
||
|
|
||
| extern "C" JSC__AbortSignal* JSC__AbortSignal__ref(JSC__AbortSignal* arg0) { | ||
| extern "C" JSC__AbortSignal* JSC__AbortSignal__ref(JSC__AbortSignal* arg0) | ||
| { | ||
| WebCore::AbortSignal* abortSignal = reinterpret_cast<WebCore::AbortSignal*>(arg0); | ||
| abortSignal->ref(); | ||
| return arg0; | ||
| } | ||
|
|
||
| extern "C" JSC__AbortSignal* JSC__AbortSignal__unref(JSC__AbortSignal* arg0) { | ||
| extern "C" JSC__AbortSignal* JSC__AbortSignal__unref(JSC__AbortSignal* arg0) | ||
| { | ||
| WebCore::AbortSignal* abortSignal = reinterpret_cast<WebCore::AbortSignal*>(arg0); | ||
| abortSignal->deref(); | ||
| return arg0; | ||
| } | ||
|
|
||
| extern "C" JSC__AbortSignal* JSC__AbortSignal__addListener(JSC__AbortSignal* arg0, void* ctx, void (*callback)(void* ctx, JSC__JSValue reason)) { | ||
| extern "C" JSC__AbortSignal* JSC__AbortSignal__addListener(JSC__AbortSignal* arg0, void* ctx, void (*callback)(void* ctx, JSC__JSValue reason)) | ||
| { | ||
| WebCore::AbortSignal* abortSignal = reinterpret_cast<WebCore::AbortSignal*>(arg0); | ||
| if(abortSignal->aborted()){ | ||
|
|
||
| if (abortSignal->aborted()) { | ||
| callback(ctx, JSC::JSValue::encode(abortSignal->reason().getValue())); | ||
| return arg0; | ||
| } | ||
|
|
@@ -3859,7 +3887,7 @@ extern "C" JSC__JSValue JSC__AbortSignal__createAbortError(const ZigString* mess | |
| error->putDirect( | ||
| vm, vm.propertyNames->name, | ||
| JSC::JSValue(JSC::jsOwnedString(vm, ABORT_ERROR_NAME)), | ||
| 0); | ||
| 0); | ||
|
|
||
| if (code.len > 0) { | ||
| auto clientData = WebCore::clientData(vm); | ||
|
|
@@ -3881,7 +3909,7 @@ extern "C" JSC__JSValue JSC__AbortSignal__createTimeoutError(const ZigString* me | |
| error->putDirect( | ||
| vm, vm.propertyNames->name, | ||
| JSC::JSValue(JSC::jsOwnedString(vm, TIMEOUT_ERROR_NAME)), | ||
| 0); | ||
| 0); | ||
|
|
||
| if (code.len > 0) { | ||
| auto clientData = WebCore::clientData(vm); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,12 +211,12 @@ pub const ZigString = extern struct { | |
|
|
||
| pub fn substring(this: ZigString, offset: usize, maxlen: usize) ZigString { | ||
| var len: usize = undefined; | ||
| if(maxlen == 0){ | ||
| if (maxlen == 0) { | ||
| len = this.len; | ||
| }else { | ||
| } else { | ||
| len = @max(this.len, maxlen); | ||
| } | ||
|
|
||
| if (this.is16Bit()) { | ||
| return ZigString.from16Slice(this.utf16SliceAligned()[@min(this.len, offset)..len]); | ||
| } | ||
|
|
@@ -2911,6 +2911,15 @@ pub const JSValue = enum(JSValueReprInt) { | |
| cppFn("forEachProperty", .{ this, globalThis, ctx, callback }); | ||
| } | ||
|
|
||
| pub fn forEachPropertyOrdered( | ||
| this: JSValue, | ||
| globalObject: *JSC.JSGlobalObject, | ||
| ctx: ?*anyopaque, | ||
| callback: PropertyIteratorFn, | ||
| ) void { | ||
| cppFn("forEachPropertyOrdered", .{ this, globalObject, ctx, callback }); | ||
| } | ||
|
|
||
| pub fn coerce(this: JSValue, comptime T: type, globalThis: *JSC.JSGlobalObject) T { | ||
| return switch (T) { | ||
| ZigString => this.getZigString(globalThis), | ||
|
|
@@ -3638,6 +3647,19 @@ pub const JSValue = enum(JSValueReprInt) { | |
| return cppFn("strictDeepEquals", .{ this, other, global }); | ||
| } | ||
|
|
||
| pub const DiffMethod = enum(u8) { | ||
| none, | ||
| character, | ||
| word, | ||
| line, | ||
| }; | ||
|
|
||
| pub fn determineDiffMethod(this: JSValue, other: JSValue, global: *JSGlobalObject) DiffMethod { | ||
| if ((this.isString() and other.isString()) or (this.jsType() == .RegExpObject and other.jsType() == .RegExpObject) or (this.isBuffer(global) and other.isBuffer(global))) return .character; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could still make
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| if (this.isObject() and other.isObject()) return .line; | ||
| return .none; | ||
| } | ||
|
|
||
| pub fn asString(this: JSValue) *JSString { | ||
| return cppFn("asString", .{ | ||
| this, | ||
|
|
@@ -3852,6 +3874,7 @@ pub const JSValue = enum(JSValueReprInt) { | |
| "fastGet_", | ||
| "forEach", | ||
| "forEachProperty", | ||
| "forEachPropertyOrdered", | ||
| "fromEntries", | ||
| "fromInt64NoTruncate", | ||
| "fromUInt64NoTruncate", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have clang-format right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, these are formatting changes after merging main