Skip to content

Commit

Permalink
Fix matching of help mode (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
c42f authored Feb 22, 2022
1 parent 0b9a5ac commit e7d18a4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RemoteREPL"
uuid = "1bd9f7bb-701c-4338-bec7-ac987af7c555"
authors = ["Chris Foster <[email protected]> and contributors"]
version = "0.2.13"
version = "0.2.14"

[deps]
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Expand Down
2 changes: 1 addition & 1 deletion src/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function parse_input(str)
end

function match_magic_syntax(str)
m = match(r"(%module|\?) *(.*)", str)
m = match(r"^(%module|\?) *(.*)", str)
if !isnothing(m)
return (m[1], m[2])
else
Expand Down
14 changes: 13 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using RemoteREPL
using Test
using Sockets
using RemoteREPL: repl_prompt_text, DEFAULT_PORT
using RemoteREPL: repl_prompt_text, match_magic_syntax, DEFAULT_PORT

ENV["JULIA_DEBUG"] = "RemoteREPL"

Expand Down Expand Up @@ -32,6 +32,18 @@ ENV["JULIA_DEBUG"] = "RemoteREPL"
end
end

@testset "Repl Magic syntax" begin
# Help mode
@test match_magic_syntax("?xx") == ("?", "xx")
@test match_magic_syntax("? xx") == ("?", "xx")
@test match_magic_syntax(" ?xx") == nothing
@test match_magic_syntax("x ? y : z") == nothing

# Module setting
@test match_magic_syntax("%module xx") == ("%module", "xx")
@test match_magic_syntax(" %module xx") == nothing
end

@testset "Prompt text" begin
function fake_conn(host, port; is_open=true)
io = IOBuffer()
Expand Down

2 comments on commit e7d18a4

@c42f
Copy link
Collaborator Author

@c42f c42f commented on e7d18a4 Feb 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/55181

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.14 -m "<description of version>" e7d18a455c809c7b18a919e50bf0ede5e6dbbbfe
git push origin v0.2.14

Please sign in to comment.