Skip to content

Conversation

@dylan-conway
Copy link
Member

Added diffz for character and line diffs. The function diffLines() is the only change to the library.

Object line diff
Screenshot 2023-02-20 at 9 39 31 PM

String character diff
Screenshot 2023-02-20 at 9 40 25 PM

Output changes for other matchers follow this format.
Before:
Screenshot 2023-02-20 at 9 44 09 PM
After:
Screenshot 2023-02-20 at 9 37 10 PM

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()));
Copy link
Collaborator

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

Copy link
Member Author

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


Vector<std::pair<String, JSValue>> ordered_properties;
for (auto property : properties) {
JSValue propertyValue = object->getDirect(vm, property);
Copy link
Collaborator

Choose a reason for hiding this comment

The 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?

};

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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could still make jsType() == .RegExpObject a fn isRegExp(this: JSValue) bool

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

var buf_writer = buffered_writer.writer();
const Writer = @TypeOf(buf_writer);

JSC.ZigConsoleClient.format(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably should make the options to format a Struct because its getting a lot of fields

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Jarred-Sumner
Copy link
Collaborator

thank you @SuperAuguste for the diff library!

@Jarred-Sumner Jarred-Sumner merged commit d786dd6 into main Feb 21, 2023
@Jarred-Sumner Jarred-Sumner deleted the dylan/update-test-runner-output branch February 21, 2023 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants