From eb7f55bb6e1c1559b0305b522363b4d65346fe2e Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sun, 14 Jul 2024 00:17:50 +0200 Subject: [PATCH] =?UTF-8?q?Add=20tests=20and=20commentary=20about=20`?= =?UTF-8?q?=E2=88=88`=20in=20non-loop=20contexts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #17. --- README.md | 7 +++---- test/runtests.jl | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ef1833c..abd33af 100644 --- a/README.md +++ b/README.md @@ -514,10 +514,9 @@ The keyword `in` is used consistently instead of `∈` and `=` in `for` loops. E +for i in 1:2 ``` -#### Potential changes - - Since `∉` exists the formatted code may become asymmetric, when both `∈` and `∉` are - used, since `∉` is left alone and not replaced by e.g. `!(...)`. See discussion in issue - [#17](https://github.com/fredrikekre/Runic.jl/issues/17). +Note that `∈` not replaced when used as an operator outside of loop contexts in +order to be symmetric with `∉` which doesn't have a direct ASCII equivalent. +See [#17](https://github.com/fredrikekre/Runic.jl/issues/17) for more details. ### Braces around right hand side of `where` diff --git a/test/runtests.jl b/test/runtests.jl index 6364170..2761508 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -467,6 +467,11 @@ end "$(l)i for i in I, j in J if i < j$(r)" end end + # ∈ is still allowed when used as an operator outside of loop contexts in order to keep + # symmetry with ∉ which doesn't have a direct ascii equivalent. + # See https://github.com/fredrikekre/Runic.jl/issues/17 + @test format_string("a ∈ A") == "a ∈ A" + @test format_string("a ∉ A") == "a ∉ A" end @testset "braces around where rhs" begin