Skip to content

Commit

Permalink
Add newline strip to prints prettily tests, tests pass now (#103)
Browse files Browse the repository at this point in the history
* Add newline strip to prints prettily tests, tests pass now

* Update actions versions for Tests

* Add julia-actions/cache to Tests

* Remove non-LTS or latest Julia versions in Tests

* Specify arch for setup-julia to avoid using x86 default
  • Loading branch information
gnadt committed Apr 30, 2024
1 parent 51ea6bc commit c1b69c9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ on:
- master
tags: '*'


jobs:
test:
timeout-minutes: 30
name: ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- '1.0'
- '1.1'
- '1.2'
- '1.3'
- '1.4'
- '1.5'
- '1.6'
- '1'
- 'nightly'
Expand All @@ -32,15 +29,16 @@ jobs:
- windows-latest
arch:
- x64

steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v4
with:
file: lcov.info
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
*.jl.mem
coverage
*~
.DS_Store
LocalPreferences.toml
Manifest.toml
test/Manifest.toml
settings.json
8 changes: 5 additions & 3 deletions test/SampleBuf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,9 @@ end
▃▄▄▅▅▅▅▅▅▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▅▅▅▅▅▅▄▄▂▄▄▅▅▅▅▅▅▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▅▅▅▅▅▅▄▄▃"""
iobuf = IOBuffer()
display(TextDisplay(iobuf), buf)
@test String(take!(iobuf)) == expected
@test strip(String(take!(iobuf)),'\n') == expected
end

@testset "1D buf prints prettily" begin
t = collect(range(0, stop=2pi, length=300))
buf = SampleBuf(cos.(t)*0.2, 48000)
Expand All @@ -509,14 +510,15 @@ end
▆▆▆▆▆▆▆▆▆▆▅▅▅▅▅▅▄▄▃▃▄▄▅▅▅▅▅▅▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▅▅▅▅▅▅▄▄▃▃▄▄▅▅▅▅▅▅▆▆▆▆▆▆▆▆▆▆"""
iobuf = IOBuffer()
display(TextDisplay(iobuf), buf)
@test String(take!(iobuf)) == expected
@test strip(String(take!(iobuf)),'\n') == expected
end

@testset "zero-length buf prints prettily" begin
buf = SampleBuf(Float64, 48000, 0, 2)
expected = """0-frame, 2-channel SampleBuf{Float64, 2}
0.0s sampled at 48000.0Hz"""
iobuf = IOBuffer()
display(TextDisplay(iobuf), buf)
@test String(take!(iobuf)) == expected
@test strip(String(take!(iobuf)),'\n') == expected
end
end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include("support/util.jl")
"SampleBuf.jl",
"SampleStream.jl",
"SinSource.jl",
"units.jl"
"units.jl"
# "WAVDisplay.jl"
])
end

0 comments on commit c1b69c9

Please sign in to comment.