From 0d4633584d87b343373e6c8abcb6ace85f97e224 Mon Sep 17 00:00:00 2001
From: Sonny Scroggin <sonny@scrogg.in>
Date: Sat, 19 Oct 2019 13:53:57 -0500
Subject: [PATCH] Add tests

---
 .gitignore                                      | 1 +
 Cargo.toml                                      | 1 +
 rustler_tests/mix.exs                           | 1 +
 rustler_tests/native/binary_example/Cargo.toml  | 9 +++++++++
 rustler_tests/native/binary_example/src/main.rs | 3 +++
 5 files changed, 15 insertions(+)
 create mode 100644 rustler_tests/native/binary_example/Cargo.toml
 create mode 100644 rustler_tests/native/binary_example/src/main.rs

diff --git a/.gitignore b/.gitignore
index 5536d6a6d..08e3d7b4b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,7 @@ Session.vim
 # Generated by Cargo
 **/target/*
 /rustler/target/
+/rustler_tests/priv/native/*
 /rustler_tests/target/
 /rustler_tests/_build
 /rustler_tests/deps
diff --git a/Cargo.toml b/Cargo.toml
index 5fcfb77dc..44979ce76 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,7 @@ members = [
   "rustler",
   "rustler_codegen",
   "rustler_sys",
+  "rustler_tests/native/binary_example",
   "rustler_tests/native/rustler_test",
   "rustler_tests/native/deprecated_macros",
 ]
diff --git a/rustler_tests/mix.exs b/rustler_tests/mix.exs
index ac6b8e837..b82869a99 100644
--- a/rustler_tests/mix.exs
+++ b/rustler_tests/mix.exs
@@ -9,6 +9,7 @@ defmodule RustlerTest.Mixfile do
      start_permanent: Mix.env() == :prod,
      compilers: [:rustler] ++ Mix.compilers(),
      rustler_crates: [
+       binary_example: [mode: :debug],
        rustler_test: [mode: :debug],
        deprecated_macros: [mode: :debug],
      ],
diff --git a/rustler_tests/native/binary_example/Cargo.toml b/rustler_tests/native/binary_example/Cargo.toml
new file mode 100644
index 000000000..d571682a9
--- /dev/null
+++ b/rustler_tests/native/binary_example/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "binary_example"
+version = "0.1.0"
+authors = []
+edition = "2018"
+
+[[bin]]
+name = "binary_example"
+path = "src/main.rs"
diff --git a/rustler_tests/native/binary_example/src/main.rs b/rustler_tests/native/binary_example/src/main.rs
new file mode 100644
index 000000000..94017d80e
--- /dev/null
+++ b/rustler_tests/native/binary_example/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+    println!("Hello from Rust!");
+}