Skip to content

Commit

Permalink
Merge pull request #195 from JuliaIO/an/info
Browse files Browse the repository at this point in the history
Don't try to extend Base.info
  • Loading branch information
SimonDanisch committed Aug 7, 2018
2 parents b69bbab + 369d792 commit 8656519
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
45 changes: 24 additions & 21 deletions appveyor.yml
@@ -1,33 +1,36 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 0.7
- julia_version: latest

platform:
- x86 # 32-bit
- x64 # 64-bit

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
#matrix:
# allow_failures:
# - julia_version: latest

branches:
only:
- master
- /release-.*/

notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# if there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
# - git fetch --unshallow
- C:\projects\julia\bin\julia -e "using InteractiveUtils; versioninfo(); import Pkg;
Pkg.clone(pwd(), \"FileIO\"); Pkg.build(\"FileIO\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia -e "import Pkg; Pkg.test(\"FileIO\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
2 changes: 1 addition & 1 deletion src/query.jl
Expand Up @@ -159,7 +159,7 @@ end
`info(fmt)` returns the magic bytes/extension information for
`DataFormat` `fmt`.
"""
Base.info(::Type{DataFormat{sym}}) where {sym} = sym2info[sym]
info(::Type{DataFormat{sym}}) where {sym} = sym2info[sym]


canonicalize_magic(m::NTuple{N,UInt8}) where {N} = m
Expand Down
8 changes: 4 additions & 4 deletions test/query.jl
Expand Up @@ -67,21 +67,21 @@ try
@test unknown(format"UNKNOWN")

add_format(format"CSV", UInt8[], ".csv")
@test info(format"CSV") == ((),".csv")
@test FileIO.info(format"CSV") == ((),".csv")
add_format(format"FOO", (), ".foo") # issue #17
@test_throws Exception info(format"OOPS")
@test_throws Exception FileIO.info(format"OOPS")
@test FileIO.ext2sym[".csv"] == :CSV
del_format(format"FOO")
@test FileIO.magic_list == [Pair((),:CSV)]
del_format(format"CSV")
@test isempty(FileIO.ext2sym)
@test isempty(FileIO.magic_list)
@test isempty(FileIO.sym2info)
@test_throws Exception info(format"CSV")
@test_throws Exception FileIO.info(format"CSV")

add_format(format"JUNK", "JUNK", [".jnk",".junk",".JNK"])

@test info(format"JUNK") == (tuple(b"JUNK"...),[".jnk",".junk",".JNK"])
@test FileIO.info(format"JUNK") == (tuple(b"JUNK"...),[".jnk",".junk",".JNK"])
@test FileIO.ext2sym[".jnk"] == :JUNK
@test FileIO.ext2sym[".junk"] == :JUNK
@test FileIO.ext2sym[".JNK"] == :JUNK
Expand Down

0 comments on commit 8656519

Please sign in to comment.