Browse Source

Add tests and commentary about `∈` in non-loop contexts

Closes #17.
pull/19/head
Fredrik Ekre 1 year ago
parent
commit
eb7f55bb6e
No known key found for this signature in database
GPG Key ID: DE82E6D5E364C0A2
  1. 7
      README.md
  2. 5
      test/runtests.jl

7
README.md

@ -514,10 +514,9 @@ The keyword `in` is used consistently instead of `∈` and `=` in `for` loops. E
+for i in 1:2 +for i in 1:2
``` ```
#### Potential changes Note that `∈` not replaced when used as an operator outside of loop contexts in
- Since `∉` exists the formatted code may become asymmetric, when both `∈` and `∉` are order to be symmetric with `∉` which doesn't have a direct ASCII equivalent.
used, since `∉` is left alone and not replaced by e.g. `!(...)`. See discussion in issue See [#17](https://github.com/fredrikekre/Runic.jl/issues/17) for more details.
[#17](https://github.com/fredrikekre/Runic.jl/issues/17).
### Braces around right hand side of `where` ### Braces around right hand side of `where`

5
test/runtests.jl

@ -467,6 +467,11 @@ end
"$(l)i for i in I, j in J if i < j$(r)" "$(l)i for i in I, j in J if i < j$(r)"
end end
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 end
@testset "braces around where rhs" begin @testset "braces around where rhs" begin

Loading…
Cancel
Save