Skip to content
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

Revive Session tests #570

Merged
merged 6 commits into from
Aug 4, 2022
Merged

Conversation

Techatrix
Copy link
Member

With this PR i have removed the dependency on stdio and instead added a std.io.Writer interface in Server.zig.
This allows us to intercept outgoing responses by the Server and more easily perform tests without having to run zls as a child process.

Additional notable changes include:

  • move main to main.zig and expose a small public interface in Server.zig
  • the arena allocator is not passed as an argument to various functions in Server.zig but instead stored in the Server struct.
  • logging can't be done globally (because of the decoupling from stdio) Globals must go! #536
  • tests now use std.testing.allocator

I wanted to store the writer in the Server struct itself and make it generic but i am not aware of a method to achieve this without having to wrap the entirety of Server.zig deeper scope.

@SuperAuguste
Copy link
Member

This is absolutely amazing; LGTM! Thank you so much! Logger changes are a little jarring but slightly less intuitive code > global state every time :P

@SuperAuguste SuperAuguste merged commit 6ed5ba8 into zigtools:master Aug 4, 2022
@Techatrix Techatrix deleted the session-tests branch August 17, 2022 17:01
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.

2 participants