From d5802046a2577252ce8efa19c407f0d2144fe02d Mon Sep 17 00:00:00 2001 From: VasanthManiVasi <44256983+VasanthManiVasi@users.noreply.github.com> Date: Sun, 25 Apr 2021 01:05:51 +0530 Subject: [PATCH] Fix deprecation errors and add tests (#141) * Fix deprecation error * Add tests for deprecation * Update Project.toml * Add temporary Manifest.toml * Remove temporary Manifest.toml --- Project.toml | 2 +- src/deprecations.jl | 6 +++--- test/midiio.jl | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 0b20eb2..0806d68 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MIDI" uuid = "f57c4921-e30c-5f49-b073-3f2f2ada663e" repo = "https://github.com/JuliaMusic/MIDI.jl.git" -version = "1.12.4" +version = "1.12.5" [deps] FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" diff --git a/src/deprecations.jl b/src/deprecations.jl index 805890a..e2f19cf 100644 --- a/src/deprecations.jl +++ b/src/deprecations.jl @@ -1,3 +1,3 @@ -@deprecate writeMIDIFile(filename::AbstractString, data::MIDIFile) MIDI.save(filename, data) -@deprecate writeMIDIFile(filename::AbstractString, notes::Notes) MIDI.save(filename, notes) -@deprecate readMIDIFile(filename::AbstractString) MIDI.load(filename) +@deprecate writeMIDIFile(filename::AbstractString, data::MIDIFile) save(File{format"MIDI"}(filename), data) +@deprecate writeMIDIFile(filename::AbstractString, notes::Notes) save(File{format"MIDI"}(filename), notes) +@deprecate readMIDIFile(filename::AbstractString) load(File{format"MIDI"}(filename)) diff --git a/test/midiio.jl b/test/midiio.jl index 59b2bb6..180eef9 100644 --- a/test/midiio.jl +++ b/test/midiio.jl @@ -25,3 +25,12 @@ cd(@__DIR__) @test notes[2].channel == 0 end + +@testset "Deprecated MIDI IO" begin + midi = load("doxy.mid") + @test_deprecated readMIDIFile("doxy.mid") + @test_deprecated writeMIDIFile("test.mid", midi) + @test_deprecated writeMIDIFile("test.midi", getnotes(midi)) + rm("test.mid") + rm("test.midi") +end