2019-06-06 14:18:00 +02:00
|
|
|
use ansi_term::Color;
|
|
|
|
use std::fs::{self, File};
|
|
|
|
use std::io;
|
2019-10-15 16:01:44 +02:00
|
|
|
use tempfile;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
2019-09-10 01:14:38 +02:00
|
|
|
use crate::common;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn folder_without_go_files() -> io::Result<()> {
|
2019-10-15 16:01:44 +02:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
|
|
|
let output = common::render_module("golang")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
|
|
|
let expected = "";
|
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_go_file() -> io::Result<()> {
|
2019-10-15 16:01:44 +02:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-10-15 17:10:16 +02:00
|
|
|
File::create(dir.path().join("main.go"))?.sync_all()?;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
|
|
|
let output = common::render_module("golang")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-05 01:13:53 +02:00
|
|
|
let expected = format!("via {} ", Color::Cyan.bold().paint("🐹 v1.12.1"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_go_mod() -> io::Result<()> {
|
2019-10-15 16:01:44 +02:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-10-15 17:10:16 +02:00
|
|
|
File::create(dir.path().join("go.mod"))?.sync_all()?;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
|
|
|
let output = common::render_module("golang")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-05 01:13:53 +02:00
|
|
|
let expected = format!("via {} ", Color::Cyan.bold().paint("🐹 v1.12.1"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_go_sum() -> io::Result<()> {
|
2019-10-15 16:01:44 +02:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-10-15 17:10:16 +02:00
|
|
|
File::create(dir.path().join("go.sum"))?.sync_all()?;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
|
|
|
let output = common::render_module("golang")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-05 01:13:53 +02:00
|
|
|
let expected = format!("via {} ", Color::Cyan.bold().paint("🐹 v1.12.1"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_godeps() -> io::Result<()> {
|
2019-10-15 16:01:44 +02:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-06-06 14:18:00 +02:00
|
|
|
let godeps = dir.path().join("Godeps");
|
|
|
|
fs::create_dir_all(&godeps)?;
|
|
|
|
|
|
|
|
let output = common::render_module("golang")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-05 01:13:53 +02:00
|
|
|
let expected = format!("via {} ", Color::Cyan.bold().paint("🐹 v1.12.1"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_glide_yaml() -> io::Result<()> {
|
2019-10-15 16:01:44 +02:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-10-15 17:10:16 +02:00
|
|
|
File::create(dir.path().join("glide.yaml"))?.sync_all()?;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
|
|
|
let output = common::render_module("golang")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-05 01:13:53 +02:00
|
|
|
let expected = format!("via {} ", Color::Cyan.bold().paint("🐹 v1.12.1"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_gopkg_yml() -> io::Result<()> {
|
2019-10-15 16:01:44 +02:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-10-15 17:10:16 +02:00
|
|
|
File::create(dir.path().join("Gopkg.yml"))?.sync_all()?;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
|
|
|
let output = common::render_module("golang")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-05 01:13:53 +02:00
|
|
|
let expected = format!("via {} ", Color::Cyan.bold().paint("🐹 v1.12.1"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn folder_with_gopkg_lock() -> io::Result<()> {
|
2019-10-15 16:01:44 +02:00
|
|
|
let dir = tempfile::tempdir()?;
|
2019-10-15 17:10:16 +02:00
|
|
|
File::create(dir.path().join("Gopkg.lock"))?.sync_all()?;
|
2019-06-06 14:18:00 +02:00
|
|
|
|
|
|
|
let output = common::render_module("golang")
|
|
|
|
.arg("--path")
|
|
|
|
.arg(dir.path())
|
|
|
|
.output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
2019-09-05 01:13:53 +02:00
|
|
|
let expected = format!("via {} ", Color::Cyan.bold().paint("🐹 v1.12.1"));
|
2019-06-06 14:18:00 +02:00
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|