Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tlienart committed Apr 10, 2019
1 parent 58e14bc commit a44cbc4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/src/lib/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ LiveServer.is_watched

## Live serving

The exported [`serve`](@ref) and [`verbose`](@ref) functions are not stated again.
The exported [`serve`](@ref) and [`setverbose`](@ref) functions are not stated again.
The `serve` method instantiates a listener (`HTTP.listen`) in an asynchronous task.
The callback upon an incoming HTTP stream decides whether it is a standard HTTP request or a request for an upgrade to a websocket connection.
The former case is handled by [`LiveServer.serve_file`](@ref), the latter by
Expand Down Expand Up @@ -78,5 +78,5 @@ LiveServer.scan_docs!

```@docs
LiveServer.example
LiveServer.verbose
LiveServer.setverbose
```
2 changes: 1 addition & 1 deletion src/server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function serve(fw::FileWatcher=SimpleWatcher(file_changed_callback);
coreloopfun::Function=(c,fw)->nothing)

8000 port 9000 || throw(ArgumentError("The port must be between 8000 and 9000."))
verbose(verbose)
setverbose(verbose)

if !isempty(dir)
isdir(dir) || throw(ArgumentError("The specified dir '$dir' is not recognised."))
Expand Down
4 changes: 2 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ end
#

"""
verbose(b)
setverbose(b)
Set the verbosity of LiveServer to either true (showing messages upon events) or false (default).
"""
verbose(b::Bool) = (VERBOSE.x = b)
setverbose(b::Bool) = (VERBOSE.x = b)

"""
example()
Expand Down
8 changes: 4 additions & 4 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ end
@test length(dw.watchedfiles) == 3 # index, index2, make
@test endswith(dw.watchedfiles[1].path, "make.jl")
@test endswith(dw.watchedfiles[2].path, "index.md")
@test endswith(dw.watchedfiles[3].path, "index2.md")
@test endswith(dw.watchedfiles[3].path, "index2.md")

cd(bk)
end

@testset "Misc utils " begin
verbose(false)
LS.setverbose(false)
@test !LS.VERBOSE.x
verbose(true)
LS.setverbose(true)
@test LS.VERBOSE.x
verbose(false) # we don't want the tests to show lots of stuff
LS.setverbose(false) # we don't want the tests to show lots of stuff

bk = pwd()
cd(mktempdir())
Expand Down

0 comments on commit a44cbc4

Please sign in to comment.