Compare commits
2 Commits
5ba61ba026
...
9596694941
Author | SHA1 | Date | |
---|---|---|---|
9596694941 | |||
fd96a13916 |
17
.drone.yml
Normal file
17
.drone.yml
Normal file
@ -0,0 +1,17 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: rust
|
||||
environment:
|
||||
SECRET_INPUT:
|
||||
from_secret: secret_input
|
||||
commands:
|
||||
- cargo build --verbose --all
|
||||
- cargo test --verbose --all
|
||||
# Simple test
|
||||
- 'echo "Input: $SECRET_INPUT"'
|
||||
- cargo run $SECRET_INPUT > output
|
||||
- 'echo "Output: " && cat output'
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -11,3 +11,8 @@ Cargo.lock
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
|
||||
|
||||
#Added by cargo
|
||||
|
||||
/target
|
||||
|
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "ci-test"
|
||||
version = "0.1.0"
|
||||
authors = ["KAAAsS <admin@kaaass.net>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
18
src/lib.rs
Normal file
18
src/lib.rs
Normal file
@ -0,0 +1,18 @@
|
||||
pub fn reverse(s : &str) -> String {
|
||||
s.chars().rev().collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_reverse() {
|
||||
let query = "hello";
|
||||
|
||||
assert_eq!(
|
||||
"olleh",
|
||||
reverse(query)
|
||||
);
|
||||
}
|
||||
}
|
11
src/main.rs
Normal file
11
src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
use std::env;
|
||||
use ci_test::reverse;
|
||||
|
||||
fn main() {
|
||||
// Read from argument
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() < 2 {
|
||||
panic!("argument invalid");
|
||||
}
|
||||
println!("{}", reverse(&args[1]));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user