前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【Rust日报】 2019-05-25:Mockiato - 一個嚴格友好的Mock測試庫

【Rust日报】 2019-05-25:Mockiato - 一個嚴格友好的Mock測試庫

作者头像
MikeLoveRust
发布2019-07-09 13:15:09
5850
发布2019-07-09 13:15:09
举报

Into The Wild

有人用rust寫了一個很像lf2(Little Fighter 2)的2.5D動作遊戲

Read more

Rust官网的国际化支持,在找人翻译

Read more Read more

「讨论」对于单人主力维护的项目如何看待

楼主覺得 actix 和 rust-postgres 很棒

但發現這兩個庫都只有一個大佬在當主力開發,他覺得庫只有一人維護對大公司來說不是問題

但對無力繼續維護的小客戶來說是個問題,大家覺得呢?

(其实很多项目都是单人在撑)

Read more

hors 0.3.0

一個類似 google search 找解答的工具

howdoi 的 rust 實作版本

比如你有個問題叫 "how to parse json in rust"

使用下列指令

代码语言:javascript
复制
hors "how to parse json in rust" -a

得到解答

代码语言:javascript
复制
- Answer from https://stackoverflow.com/questions/30292752/how-do-i-parse-a-json-file

Solved by the many helpful members of the Rust community:

extern crate rustc_serialize;
use rustc_serialize::json::Json;
use std::fs::File;
use std::io::Read;

fn main() {
    let mut file = File::open("text.json").unwrap();
    let mut data = String::new();
    file.read_to_string(&mut data).unwrap();

    let json = Json::from_str(&data).unwrap();
    println!("{}", json.find_path(&["Address", "Street"]).unwrap());
}

Read more

Mockiato :一個嚴格友好的Mock測試庫

對測試有需求的同學可以試試看

代码语言:javascript
复制
#[cfg(test)]
use mockiato::mockable;

#[cfg_attr(test, mockable)]
trait Greeter {
    fn greet(&self, name: &str) -> String;
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn greet_the_world() {
        let mut greeter = GreeterMock::new();

        greeter
            .expect_greet(|arg| arg.partial_eq("world"))
            .returns(String::from("Hello world"));

        assert_eq!("Hello world", greeter.greet("world"));
    }
}

Read more

cargo-cache 0.2.1

這個工具可以幫助你管理 ~/.cargo/ 或 ${CARGO_HOME}

代码语言:javascript
复制
Cargo cache '/home/matthias/.cargo':

Total size:                             7.22 GB
Size of 101 installed binaries:           909.51 MB
Size of registry:                         1.46 GB
Size of registry index:                     63.65 MB
Size of 3082 crate archives:                435.72 MB
Size of 2038 crate source checkouts:        963.10 MB
Size of git db:                           4.84 GB
Size of 107 bare git repos:                 980.81 MB
Size of 100 git repo checkouts:             3.86 GB
代码语言:javascript
复制
cargo cache query "^serde*"

Registry cache sorted by name:
    serde-0.6.15: 16988
    serde-0.7.15: 22719
    serde-0.8.23: 25824
[...]

Registry source cache sorted by name:
    serde-0.8.23: 168461
    serde-1.0.80: 477759
    serde-1.0.82: 485084
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-05-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Rust语言学习交流 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Into The Wild
  • Rust官网的国际化支持,在找人翻译
  • 「讨论」对于单人主力维护的项目如何看待
  • hors 0.3.0
  • Mockiato :一個嚴格友好的Mock測試庫
  • cargo-cache 0.2.1
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档