From 1acb79fe8b471e0e06939db76df81aa7195fd45f Mon Sep 17 00:00:00 2001 From: Arya Irani Date: Mon, 30 Sep 2024 14:24:18 -0400 Subject: [PATCH 1/3] first iteration of minimizing the issue --- multiline-chars.md | 4 +++ multiline-chars.output.md | 61 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 multiline-chars.md create mode 100644 multiline-chars.output.md diff --git a/multiline-chars.md b/multiline-chars.md new file mode 100644 index 0000000000..4bf59c8e22 --- /dev/null +++ b/multiline-chars.md @@ -0,0 +1,4 @@ +```ucm +scratch/main> clone @unison/http/releases/3.3.2 +@unison/http/releases/3.3.2> edit HttpResponse.pattern.statusLine.testReasonIsOptional tests.testFromStream +``` diff --git a/multiline-chars.output.md b/multiline-chars.output.md new file mode 100644 index 0000000000..157b003f6a --- /dev/null +++ b/multiline-chars.output.md @@ -0,0 +1,61 @@ +``` ucm +scratch/main> clone @unison/http/releases/3.3.2 + + Downloaded 23893 entities. + + Cloned @unison/http/releases/3.3.2. + +@unison/http/releases/3.3.2> edit HttpResponse.pattern.statusLine.testReasonIsOptional tests.testFromStream + + ☝️ + + I added 2 definitions to the top of scratch.u + + You can edit them there, then run `update` to replace the + definitions currently in this namespace. + +``` +``` unison:added-by-ucm scratch.u +test> HttpResponse.pattern.statusLine.testReasonIsOptional = + parsed = catch do + statusNoReason = + """ + HTTP/1.1 200 + rest + """ + IPattern.run statusLine statusNoReason + verifyAndIgnore do + assertEquals parsed (Right (Some (["HTTP/1.1", "200", ""], "\r\nrest"))) + +test> tests.testFromStream = + verifyAndIgnore do + use Path / + use Text toUtf8 + request = + """ + GET /docs?%25wei?rd=%26he+llo/&%25wei?rd=+th%23er%3de%25&simple=foo HTTP/1.0 + Content-Type: text/plain + Content-Length: 12 + + Hello World! + """ + stream = do emit (toUtf8 request) + actual = HttpRequest.fromStream stream + headers = + Headers.fromList + [("Content-Type", "text/plain"), ("Content-Length", "12")] + expected = + HttpRequest + GET + Version.http10 + (URI + (Scheme "") + None + (root / "docs") + (RawQuery "%25wei?rd=%26he+llo/&%25wei?rd=+th%23er%3de%25&simple=foo") + Fragment.empty) + headers + (Body (toUtf8 "Hello World!")) + test.ensureEqual expected actual +``` + From d8e4182b21dfdba270029aec2a856f20921b9ce8 Mon Sep 17 00:00:00 2001 From: Arya Irani Date: Mon, 30 Sep 2024 16:38:21 -0400 Subject: [PATCH 2/3] try simpler case --- multiline-chars.md | 4 -- multiline-chars.output.md | 61 ------------------- unison-src/transcripts/multiline-strings.md | 14 +++++ .../transcripts/multiline-strings.output.md | 51 ++++++++++++++++ 4 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 multiline-chars.md delete mode 100644 multiline-chars.output.md create mode 100644 unison-src/transcripts/multiline-strings.md create mode 100644 unison-src/transcripts/multiline-strings.output.md diff --git a/multiline-chars.md b/multiline-chars.md deleted file mode 100644 index 4bf59c8e22..0000000000 --- a/multiline-chars.md +++ /dev/null @@ -1,4 +0,0 @@ -```ucm -scratch/main> clone @unison/http/releases/3.3.2 -@unison/http/releases/3.3.2> edit HttpResponse.pattern.statusLine.testReasonIsOptional tests.testFromStream -``` diff --git a/multiline-chars.output.md b/multiline-chars.output.md deleted file mode 100644 index 157b003f6a..0000000000 --- a/multiline-chars.output.md +++ /dev/null @@ -1,61 +0,0 @@ -``` ucm -scratch/main> clone @unison/http/releases/3.3.2 - - Downloaded 23893 entities. - - Cloned @unison/http/releases/3.3.2. - -@unison/http/releases/3.3.2> edit HttpResponse.pattern.statusLine.testReasonIsOptional tests.testFromStream - - ☝️ - - I added 2 definitions to the top of scratch.u - - You can edit them there, then run `update` to replace the - definitions currently in this namespace. - -``` -``` unison:added-by-ucm scratch.u -test> HttpResponse.pattern.statusLine.testReasonIsOptional = - parsed = catch do - statusNoReason = - """ - HTTP/1.1 200 - rest - """ - IPattern.run statusLine statusNoReason - verifyAndIgnore do - assertEquals parsed (Right (Some (["HTTP/1.1", "200", ""], "\r\nrest"))) - -test> tests.testFromStream = - verifyAndIgnore do - use Path / - use Text toUtf8 - request = - """ - GET /docs?%25wei?rd=%26he+llo/&%25wei?rd=+th%23er%3de%25&simple=foo HTTP/1.0 - Content-Type: text/plain - Content-Length: 12 - - Hello World! - """ - stream = do emit (toUtf8 request) - actual = HttpRequest.fromStream stream - headers = - Headers.fromList - [("Content-Type", "text/plain"), ("Content-Length", "12")] - expected = - HttpRequest - GET - Version.http10 - (URI - (Scheme "") - None - (root / "docs") - (RawQuery "%25wei?rd=%26he+llo/&%25wei?rd=+th%23er%3de%25&simple=foo") - Fragment.empty) - headers - (Body (toUtf8 "Hello World!")) - test.ensureEqual expected actual -``` - diff --git a/unison-src/transcripts/multiline-strings.md b/unison-src/transcripts/multiline-strings.md new file mode 100644 index 0000000000..1a3f8101c6 --- /dev/null +++ b/unison-src/transcripts/multiline-strings.md @@ -0,0 +1,14 @@ +```unison +string = + """ + a + b + + c + """ +``` + +```ucm +scratch/main> add +scratch/main> edit string +``` diff --git a/unison-src/transcripts/multiline-strings.output.md b/unison-src/transcripts/multiline-strings.output.md new file mode 100644 index 0000000000..24fd0e3193 --- /dev/null +++ b/unison-src/transcripts/multiline-strings.output.md @@ -0,0 +1,51 @@ +``` unison +string = + """ + a + b + + c + """ +``` + +``` ucm + + Loading changes detected in scratch.u. + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + string : ##Text + +``` +``` ucm +scratch/main> add + + ⍟ I've added these definitions: + + string : ##Text + +scratch/main> edit string + + ☝️ + + I added 1 definitions to the top of scratch.u + + You can edit them there, then run `update` to replace the + definitions currently in this namespace. + +``` +``` unison:added-by-ucm scratch.u +string : ##Text +string = + """ + a + b + + c + """ +``` + From 2d9f6644fdfdda167ef0caf695a4b9cd31e46265 Mon Sep 17 00:00:00 2001 From: Arya Irani Date: Mon, 30 Sep 2024 23:57:35 -0400 Subject: [PATCH 3/3] re-add the clone example --- unison-src/transcripts/multiline-strings0.md | 4 ++ .../transcripts/multiline-strings0.output.md | 61 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 unison-src/transcripts/multiline-strings0.md create mode 100644 unison-src/transcripts/multiline-strings0.output.md diff --git a/unison-src/transcripts/multiline-strings0.md b/unison-src/transcripts/multiline-strings0.md new file mode 100644 index 0000000000..4bf59c8e22 --- /dev/null +++ b/unison-src/transcripts/multiline-strings0.md @@ -0,0 +1,4 @@ +```ucm +scratch/main> clone @unison/http/releases/3.3.2 +@unison/http/releases/3.3.2> edit HttpResponse.pattern.statusLine.testReasonIsOptional tests.testFromStream +``` diff --git a/unison-src/transcripts/multiline-strings0.output.md b/unison-src/transcripts/multiline-strings0.output.md new file mode 100644 index 0000000000..157b003f6a --- /dev/null +++ b/unison-src/transcripts/multiline-strings0.output.md @@ -0,0 +1,61 @@ +``` ucm +scratch/main> clone @unison/http/releases/3.3.2 + + Downloaded 23893 entities. + + Cloned @unison/http/releases/3.3.2. + +@unison/http/releases/3.3.2> edit HttpResponse.pattern.statusLine.testReasonIsOptional tests.testFromStream + + ☝️ + + I added 2 definitions to the top of scratch.u + + You can edit them there, then run `update` to replace the + definitions currently in this namespace. + +``` +``` unison:added-by-ucm scratch.u +test> HttpResponse.pattern.statusLine.testReasonIsOptional = + parsed = catch do + statusNoReason = + """ + HTTP/1.1 200 + rest + """ + IPattern.run statusLine statusNoReason + verifyAndIgnore do + assertEquals parsed (Right (Some (["HTTP/1.1", "200", ""], "\r\nrest"))) + +test> tests.testFromStream = + verifyAndIgnore do + use Path / + use Text toUtf8 + request = + """ + GET /docs?%25wei?rd=%26he+llo/&%25wei?rd=+th%23er%3de%25&simple=foo HTTP/1.0 + Content-Type: text/plain + Content-Length: 12 + + Hello World! + """ + stream = do emit (toUtf8 request) + actual = HttpRequest.fromStream stream + headers = + Headers.fromList + [("Content-Type", "text/plain"), ("Content-Length", "12")] + expected = + HttpRequest + GET + Version.http10 + (URI + (Scheme "") + None + (root / "docs") + (RawQuery "%25wei?rd=%26he+llo/&%25wei?rd=+th%23er%3de%25&simple=foo") + Fragment.empty) + headers + (Body (toUtf8 "Hello World!")) + test.ensureEqual expected actual +``` +