Add a basic rust test in
This commit is contained in:
parent
bb61e6fe7c
commit
1ca23ca4cf
@ -1,7 +1,24 @@
|
|||||||
// #![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
// #![allow(dead_code)]
|
// #![allow(dead_code)]
|
||||||
// #![allow(unused_variables)]
|
// #![allow(unused_variables)]
|
||||||
|
|
||||||
|
|
||||||
|
use pyo3::prelude::*;
|
||||||
|
use pyo3::wrap_pyfunction;
|
||||||
|
use pyo3::types::{PyDict, PyInt, PyList, PyString};
|
||||||
|
|
||||||
|
#[pyfunction]
|
||||||
|
fn hello(_py: Python, name: &str) -> PyResult<String> {
|
||||||
|
Ok(format!("Hello, {}!", name))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[pymodule]
|
||||||
|
fn rust(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||||
|
m.add_function(wrap_pyfunction!(hello, m)?).unwrap();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// use rsfdb::listiterator::KeyValueLevel;
|
// use rsfdb::listiterator::KeyValueLevel;
|
||||||
// use rsfdb::request::Request;
|
// use rsfdb::request::Request;
|
||||||
// use rsfdb::FDB;
|
// use rsfdb::FDB;
|
||||||
@ -9,8 +26,6 @@
|
|||||||
// use serde_json::{json, Value};
|
// use serde_json::{json, Value};
|
||||||
// use std::time::Instant;
|
// use std::time::Instant;
|
||||||
|
|
||||||
// use pyo3::prelude::*;
|
|
||||||
// use pyo3::types::{PyDict, PyInt, PyList, PyString};
|
|
||||||
|
|
||||||
// use std::collections::HashMap;
|
// use std::collections::HashMap;
|
||||||
|
|
||||||
|
5
tests/test_rust.py
Normal file
5
tests/test_rust.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from qubed.rust import hello
|
||||||
|
|
||||||
|
|
||||||
|
def test_hello():
|
||||||
|
assert hello("World") == "Hello, World!"
|
Loading…
x
Reference in New Issue
Block a user