From 6e7b7c58780a2498f11ff6783f1f3fb1065c27ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Gru=CC=88nwald?= Date: Mon, 12 Aug 2024 11:59:58 +0200 Subject: [PATCH] gleam format --- src/chrome.gleam | 8 +- src/protocol/debugger.gleam | 12 +- src/protocol/emulation.gleam | 4 +- src/protocol/fetch.gleam | 4 +- src/protocol/input.gleam | 4 +- src/protocol/network.gleam | 8 +- src/protocol/page.gleam | 4 +- src/protocol/runtime.gleam | 8 +- .../justin_fork/test/justin_fork_test.gleam | 110 ++++++------------ 9 files changed, 72 insertions(+), 90 deletions(-) diff --git a/src/chrome.gleam b/src/chrome.gleam index 8a844ae..fea14e9 100644 --- a/src/chrome.gleam +++ b/src/chrome.gleam @@ -536,10 +536,10 @@ fn map_non_data_port_msg(msg: d.Dynamic) -> Message { /// Processes an input string and returns a list of complete packets /// as well as the updated buffer containing overflow data @internal -pub fn process_port_message(input: String, buffer: sb.StringBuilder) -> #( - List(String), - sb.StringBuilder, -) { +pub fn process_port_message( + input: String, + buffer: sb.StringBuilder, +) -> #(List(String), sb.StringBuilder) { case string.split(input, "\u{0000}") { [unterminated_msg] -> #([], sb.append(buffer, unterminated_msg)) // Match on this case directly even though it would be handled by the next case diff --git a/src/protocol/debugger.gleam b/src/protocol/debugger.gleam index eed6706..e18cbc1 100644 --- a/src/protocol/debugger.gleam +++ b/src/protocol/debugger.gleam @@ -742,7 +742,9 @@ pub type ContinueToLocationTargetCallFrames { } @internal -pub fn encode__continue_to_location_target_call_frames(value__: ContinueToLocationTargetCallFrames) { +pub fn encode__continue_to_location_target_call_frames( + value__: ContinueToLocationTargetCallFrames, +) { case value__ { ContinueToLocationTargetCallFramesAny -> "any" ContinueToLocationTargetCallFramesCurrent -> "current" @@ -1094,7 +1096,9 @@ pub type SetInstrumentationBreakpointInstrumentation { } @internal -pub fn encode__set_instrumentation_breakpoint_instrumentation(value__: SetInstrumentationBreakpointInstrumentation) { +pub fn encode__set_instrumentation_breakpoint_instrumentation( + value__: SetInstrumentationBreakpointInstrumentation, +) { case value__ { SetInstrumentationBreakpointInstrumentationBeforeScriptExecution -> "beforeScriptExecution" @@ -1105,7 +1109,9 @@ pub fn encode__set_instrumentation_breakpoint_instrumentation(value__: SetInstru } @internal -pub fn decode__set_instrumentation_breakpoint_instrumentation(value__: dynamic.Dynamic) { +pub fn decode__set_instrumentation_breakpoint_instrumentation( + value__: dynamic.Dynamic, +) { case dynamic.string(value__) { Ok("beforeScriptExecution") -> Ok(SetInstrumentationBreakpointInstrumentationBeforeScriptExecution) diff --git a/src/protocol/emulation.gleam b/src/protocol/emulation.gleam index 1af6dc1..3298deb 100644 --- a/src/protocol/emulation.gleam +++ b/src/protocol/emulation.gleam @@ -382,7 +382,9 @@ pub type SetEmulatedVisionDeficiencyType { } @internal -pub fn encode__set_emulated_vision_deficiency_type(value__: SetEmulatedVisionDeficiencyType) { +pub fn encode__set_emulated_vision_deficiency_type( + value__: SetEmulatedVisionDeficiencyType, +) { case value__ { SetEmulatedVisionDeficiencyTypeNone -> "none" SetEmulatedVisionDeficiencyTypeBlurredVision -> "blurredVision" diff --git a/src/protocol/fetch.gleam b/src/protocol/fetch.gleam index 23c24cf..0808e37 100644 --- a/src/protocol/fetch.gleam +++ b/src/protocol/fetch.gleam @@ -241,7 +241,9 @@ pub type AuthChallengeResponseResponse { } @internal -pub fn encode__auth_challenge_response_response(value__: AuthChallengeResponseResponse) { +pub fn encode__auth_challenge_response_response( + value__: AuthChallengeResponseResponse, +) { case value__ { AuthChallengeResponseResponseDefault -> "Default" AuthChallengeResponseResponseCancelAuth -> "CancelAuth" diff --git a/src/protocol/input.gleam b/src/protocol/input.gleam index 1a78bab..72133e2 100644 --- a/src/protocol/input.gleam +++ b/src/protocol/input.gleam @@ -425,7 +425,9 @@ pub type DispatchMouseEventPointerType { } @internal -pub fn encode__dispatch_mouse_event_pointer_type(value__: DispatchMouseEventPointerType) { +pub fn encode__dispatch_mouse_event_pointer_type( + value__: DispatchMouseEventPointerType, +) { case value__ { DispatchMouseEventPointerTypeMouse -> "mouse" DispatchMouseEventPointerTypePen -> "pen" diff --git a/src/protocol/network.gleam b/src/protocol/network.gleam index c40246f..4f41a35 100644 --- a/src/protocol/network.gleam +++ b/src/protocol/network.gleam @@ -906,7 +906,9 @@ pub type CertificateTransparencyCompliance { } @internal -pub fn encode__certificate_transparency_compliance(value__: CertificateTransparencyCompliance) { +pub fn encode__certificate_transparency_compliance( + value__: CertificateTransparencyCompliance, +) { case value__ { CertificateTransparencyComplianceUnknown -> "unknown" CertificateTransparencyComplianceNotCompliant -> "not-compliant" @@ -1201,7 +1203,9 @@ pub type ServiceWorkerResponseSource { } @internal -pub fn encode__service_worker_response_source(value__: ServiceWorkerResponseSource) { +pub fn encode__service_worker_response_source( + value__: ServiceWorkerResponseSource, +) { case value__ { ServiceWorkerResponseSourceCacheStorage -> "cache-storage" ServiceWorkerResponseSourceHttpCache -> "http-cache" diff --git a/src/protocol/page.gleam b/src/protocol/page.gleam index a3fa37b..93f3390 100644 --- a/src/protocol/page.gleam +++ b/src/protocol/page.gleam @@ -505,7 +505,9 @@ pub type AddScriptToEvaluateOnNewDocumentResponse { } @internal -pub fn decode__add_script_to_evaluate_on_new_document_response(value__: dynamic.Dynamic) { +pub fn decode__add_script_to_evaluate_on_new_document_response( + value__: dynamic.Dynamic, +) { use identifier <- result.try(dynamic.field( "identifier", decode__script_identifier, diff --git a/src/protocol/runtime.gleam b/src/protocol/runtime.gleam index 84c7939..25a11a6 100644 --- a/src/protocol/runtime.gleam +++ b/src/protocol/runtime.gleam @@ -63,7 +63,9 @@ pub type SerializationOptionsSerialization { } @internal -pub fn encode__serialization_options_serialization(value__: SerializationOptionsSerialization) { +pub fn encode__serialization_options_serialization( + value__: SerializationOptionsSerialization, +) { case value__ { SerializationOptionsSerializationDeep -> "deep" SerializationOptionsSerializationJson -> "json" @@ -772,7 +774,9 @@ pub type ExecutionContextDescription { } @internal -pub fn encode__execution_context_description(value__: ExecutionContextDescription) { +pub fn encode__execution_context_description( + value__: ExecutionContextDescription, +) { json.object( [ #("id", encode__execution_context_id(value__.id)), diff --git a/vendor/justin_fork/test/justin_fork_test.gleam b/vendor/justin_fork/test/justin_fork_test.gleam index 088ddb1..934efdd 100644 --- a/vendor/justin_fork/test/justin_fork_test.gleam +++ b/vendor/justin_fork/test/justin_fork_test.gleam @@ -7,93 +7,53 @@ pub fn main() { } const snake_cases = [ - #("", ""), - #("snake case", "snake_case"), - #("snakeCase", "snake_case"), - #("SNAKECase", "snake_case"), - #("Snake-Case", "snake_case"), - #("Snake_Case", "snake_case"), - #("SnakeCase", "snake_case"), - #("Snake.Case", "snake_case"), - #("SNAKE_CASE", "snake_case"), - #("--snake-case--", "snake_case"), - #("snake#case", "snake_case"), - #("snake?!case", "snake_case"), - #("snake\tcase", "snake_case"), - #("snake\ncase", "snake_case"), - #("λambdaΛambda", "λambda_λambda"), + #("", ""), #("snake case", "snake_case"), #("snakeCase", "snake_case"), + #("SNAKECase", "snake_case"), #("Snake-Case", "snake_case"), + #("Snake_Case", "snake_case"), #("SnakeCase", "snake_case"), + #("Snake.Case", "snake_case"), #("SNAKE_CASE", "snake_case"), + #("--snake-case--", "snake_case"), #("snake#case", "snake_case"), + #("snake?!case", "snake_case"), #("snake\tcase", "snake_case"), + #("snake\ncase", "snake_case"), #("λambdaΛambda", "λambda_λambda"), ] const camel_cases = [ - #("", ""), - #("snake case", "snakeCase"), - #("snakeCase", "snakeCase"), - #("Snake-Case", "snakeCase"), - #("SNAKECase", "snakeCase"), - #("Snake_Case", "snakeCase"), - #("SnakeCase", "snakeCase"), - #("Snake.Case", "snakeCase"), - #("SNAKE_CASE", "snakeCase"), - #("--snake-case--", "snakeCase"), - #("snake#case", "snakeCase"), - #("snake?!case", "snakeCase"), - #("snake\tcase", "snakeCase"), - #("snake\ncase", "snakeCase"), - #("λambda_λambda", "λambdaΛambda"), + #("", ""), #("snake case", "snakeCase"), #("snakeCase", "snakeCase"), + #("Snake-Case", "snakeCase"), #("SNAKECase", "snakeCase"), + #("Snake_Case", "snakeCase"), #("SnakeCase", "snakeCase"), + #("Snake.Case", "snakeCase"), #("SNAKE_CASE", "snakeCase"), + #("--snake-case--", "snakeCase"), #("snake#case", "snakeCase"), + #("snake?!case", "snakeCase"), #("snake\tcase", "snakeCase"), + #("snake\ncase", "snakeCase"), #("λambda_λambda", "λambdaΛambda"), ] const pascal_cases = [ - #("", ""), - #("snake case", "SnakeCase"), - #("snakeCase", "SnakeCase"), - #("SNAKECase", "SnakeCase"), - #("Snake-Case", "SnakeCase"), - #("Snake_Case", "SnakeCase"), - #("SnakeCase", "SnakeCase"), - #("Snake.Case", "SnakeCase"), - #("SNAKE_CASE", "SnakeCase"), - #("--snake-case--", "SnakeCase"), - #("snake#case", "SnakeCase"), - #("snake?!case", "SnakeCase"), - #("snake\tcase", "SnakeCase"), - #("snake\ncase", "SnakeCase"), - #("λambda_λambda", "ΛambdaΛambda"), + #("", ""), #("snake case", "SnakeCase"), #("snakeCase", "SnakeCase"), + #("SNAKECase", "SnakeCase"), #("Snake-Case", "SnakeCase"), + #("Snake_Case", "SnakeCase"), #("SnakeCase", "SnakeCase"), + #("Snake.Case", "SnakeCase"), #("SNAKE_CASE", "SnakeCase"), + #("--snake-case--", "SnakeCase"), #("snake#case", "SnakeCase"), + #("snake?!case", "SnakeCase"), #("snake\tcase", "SnakeCase"), + #("snake\ncase", "SnakeCase"), #("λambda_λambda", "ΛambdaΛambda"), ] const kebab_cases = [ - #("", ""), - #("snake case", "snake-case"), - #("snakeCase", "snake-case"), - #("SNAKECase", "snake-case"), - #("Snake-Case", "snake-case"), - #("Snake_Case", "snake-case"), - #("SnakeCase", "snake-case"), - #("Snake.Case", "snake-case"), - #("SNAKE_CASE", "snake-case"), - #("--snake-case--", "snake-case"), - #("snake#case", "snake-case"), - #("snake?!case", "snake-case"), - #("snake\tcase", "snake-case"), - #("snake\ncase", "snake-case"), - #("λambda_λambda", "λambda-λambda"), + #("", ""), #("snake case", "snake-case"), #("snakeCase", "snake-case"), + #("SNAKECase", "snake-case"), #("Snake-Case", "snake-case"), + #("Snake_Case", "snake-case"), #("SnakeCase", "snake-case"), + #("Snake.Case", "snake-case"), #("SNAKE_CASE", "snake-case"), + #("--snake-case--", "snake-case"), #("snake#case", "snake-case"), + #("snake?!case", "snake-case"), #("snake\tcase", "snake-case"), + #("snake\ncase", "snake-case"), #("λambda_λambda", "λambda-λambda"), ] const sentence_cases = [ - #("", ""), - #("snake case", "Snake case"), - #("snakeCase", "Snake case"), - #("SNAKECase", "Snake case"), - #("Snake-Case", "Snake case"), - #("Snake_Case", "Snake case"), - #("SnakeCase", "Snake case"), - #("Snake.Case", "Snake case"), - #("SNAKE_CASE", "Snake case"), - #("--snake-case--", "Snake case"), - #("snake#case", "Snake case"), - #("snake?!case", "Snake case"), - #("snake\tcase", "Snake case"), - #("snake\ncase", "Snake case"), - #("λambda_λambda", "Λambda λambda"), + #("", ""), #("snake case", "Snake case"), #("snakeCase", "Snake case"), + #("SNAKECase", "Snake case"), #("Snake-Case", "Snake case"), + #("Snake_Case", "Snake case"), #("SnakeCase", "Snake case"), + #("Snake.Case", "Snake case"), #("SNAKE_CASE", "Snake case"), + #("--snake-case--", "Snake case"), #("snake#case", "Snake case"), + #("snake?!case", "Snake case"), #("snake\tcase", "Snake case"), + #("snake\ncase", "Snake case"), #("λambda_λambda", "Λambda λambda"), ] fn run_cases(cases: List(#(String, String)), function: fn(String) -> String) {