Skip to content

Commit 64a66ec

Browse files
committed
Work around differences in GitHub CI vs. Travis
1 parent 996d3b5 commit 64a66ec

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

deps/build.jl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using StrTables
44

55
const VER = UInt32(1)
66

7-
const datapath = "../data"
7+
const datapath = joinpath(@__DIR__, "..", "data")
88
const dpath = "https://www.unicode.org/Public/UCD/latest/ucd/"
99
const inpname = "UnicodeData.txt"
1010
const fname = "unicode.dat"
@@ -48,10 +48,15 @@ function load_unicode_data(datapath, dpath, fname)
4848
println("Loading Unicode Data: ", lname)
4949
src = lname
5050
else
51-
src = string(dpath, fname)
52-
println("Downloading Unicode Data: ", src)
53-
download(src, lname)
54-
println("Saved to: ", lname)
51+
try
52+
src = string(dpath, fname)
53+
println("Downloading Unicode Data: ", src)
54+
download(src, lname)
55+
println("Saved to: ", lname)
56+
catch ex
57+
println("Unable to download $src and save in $lname")
58+
rethrow(ex)
59+
end
5560
end
5661
symnam = String[]
5762
symval = UInt32[]
@@ -280,10 +285,10 @@ else
280285
try
281286
global tup
282287
tup = make_tables(datapath, dpath, inpname)
288+
println("Saving tables to ", savfile)
289+
StrTables.save(savfile, tup)
290+
println("Done")
283291
catch ex
284292
println(sprint(showerror, ex, catch_backtrace()))
285293
end
286-
println("Saving tables to ", savfile)
287-
StrTables.save(savfile, tup)
288-
println("Done")
289294
end

test/runtests.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using StrTables, Unicode_Entities
22

3-
@static VERSION < v"0.7.0-DEV" ? (using Base.Test) : (using Test)
3+
using Test
44

55
# Test the functions lookupname, matches, longestmatches, completions
66
# Check that characters from all 3 tables (BMP, non-BMP, 2 character) are tested
77

88
const def = Unicode_Entities.default
99

10-
const datapath = "../data"
10+
const datapath = joinpath(pathof(Unicode_Entities), "data")
1111
const dpath = "ftp://ftp.unicode.org/Public/UNIDATA/"
1212
const fname = "UnicodeData.txt"
1313

@@ -17,7 +17,15 @@ const symval = Vector{Char}()
1717
"""Load up all names and characters from original data file"""
1818
function load_unicode_data()
1919
lname = joinpath(datapath, fname)
20-
isfile(lname) || download(string(dpath, fname), lname)
20+
if !isfile(lname)
21+
try
22+
lname = download(string(dpath, fname), lname)
23+
catch ex
24+
println("Error loading \"$(string(dpath, fname))\" and saving in \"$lname\"")
25+
println(sprint(showerror, ex, catch_backtrace()))
26+
return false
27+
end
28+
end
2129
aliasnam = Vector{String}()
2230
aliasval = Vector{Char}()
2331
open(lname, "r") do f
@@ -48,13 +56,11 @@ function load_unicode_data()
4856
push!(symval, ch)
4957
end
5058
end
59+
true
5160
end
5261

53-
load_unicode_data()
54-
5562
@testset "Unicode_Entities" begin
56-
57-
@testset "matches data file" begin
63+
if load_unicode_data() @testset "matches data file" begin
5864
for (i, ch) in enumerate(symval)
5965
list = matchchar(def, ch)
6066
if !isempty(list)
@@ -68,6 +74,7 @@ load_unicode_data()
6874
end
6975
end
7076
end
77+
end
7178

7279
@testset "lookupname" begin
7380
@test lookupname(def, "foobar") == ""

0 commit comments

Comments
 (0)