Up tool versions, fix warnings on rustler and add basic test
This commit is contained in:
parent
c667c55db8
commit
1818b0b13a
@ -1,2 +1,2 @@
|
|||||||
erlang 20.0
|
erlang 21.0
|
||||||
elixir 1.9.0-otp-20
|
elixir 1.9.0-otp-21
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#[macro_use] extern crate rustler;
|
#[macro_use] extern crate rustler;
|
||||||
#[macro_use] extern crate rustler_codegen;
|
extern crate rustler_codegen;
|
||||||
#[macro_use] extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
extern crate calamine;
|
extern crate calamine;
|
||||||
|
|
||||||
use rustler::{Env, NifResult, Encoder, Term};
|
use rustler::{Env, NifResult, Encoder, Term};
|
||||||
|
|||||||
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
|
defmodule XlerTest do
|
||||||
use ExUnit.Case
|
use ExUnit.Case
|
||||||
doctest Xler
|
# doctest Xler
|
||||||
|
|
||||||
test "greets the world" do
|
def file(), do: File.cwd!() <> "/test/data/sample.xlsx"
|
||||||
assert Xler.hello() == :world
|
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user