Skip to content

Commit

Permalink
gleam format
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasGruenwald committed Aug 12, 2024
1 parent e24e25c commit 6e7b7c5
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 90 deletions.
8 changes: 4 additions & 4 deletions src/chrome.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions src/protocol/debugger.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/protocol/emulation.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/protocol/fetch.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/protocol/input.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 6 additions & 2 deletions src/protocol/network.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/protocol/page.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions src/protocol/runtime.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)),
Expand Down
110 changes: 35 additions & 75 deletions vendor/justin_fork/test/justin_fork_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6e7b7c5

Please sign in to comment.