Merge branch 'fix-rust-warnings' into 'master'
Up tool versions, fix warnings on rustler and add basic test See merge request jnylen/xler!2
This commit is contained in:
commit
40f3b97901
@ -1,2 +1,2 @@
|
||||
erlang 20.0
|
||||
elixir 1.9.0-otp-20
|
||||
erlang 21.0
|
||||
elixir 1.9.0-otp-21
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#[macro_use] extern crate rustler;
|
||||
#[macro_use] extern crate rustler_codegen;
|
||||
#[macro_use] extern crate lazy_static;
|
||||
extern crate rustler_codegen;
|
||||
extern crate lazy_static;
|
||||
extern crate calamine;
|
||||
|
||||
use rustler::{Env, NifResult, Encoder, Term, SchedulerFlags};
|
||||
|
||||
BIN
test/data/sample.xlsx
Normal file
BIN
test/data/sample.xlsx
Normal file
Binary file not shown.
@ -1,8 +1,39 @@
|
||||
defmodule XlerTest do
|
||||
use ExUnit.Case
|
||||
doctest Xler
|
||||
# doctest Xler
|
||||
|
||||
test "greets the world" do
|
||||
assert Xler.hello() == :world
|
||||
def file(), do: File.cwd!() <> "/test/data/sample.xlsx"
|
||||
|
||||
test "can read worksheets from xlsx file" do
|
||||
assert Xler.worksheets(file()) == {:ok, ["Sheet1"]}
|
||||
end
|
||||
|
||||
test "gets a list of data returned via the worksheet name" do
|
||||
{:ok, data} = Xler.parse(file(), "Sheet1")
|
||||
|
||||
assert length(data) == 701
|
||||
end
|
||||
|
||||
test "returns the correct first row" do
|
||||
{:ok, data} = Xler.parse(file(), "Sheet1")
|
||||
|
||||
assert data |> List.first() == [
|
||||
"Segment",
|
||||
"Country",
|
||||
"Product",
|
||||
"Discount Band",
|
||||
"Units Sold",
|
||||
"Manufacturing Price",
|
||||
"Sale Price",
|
||||
"Gross Sales",
|
||||
"Discounts",
|
||||
" Sales",
|
||||
"COGS",
|
||||
"Profit",
|
||||
"Date",
|
||||
"Month Number",
|
||||
"Month Name",
|
||||
"Year"
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user