Files
google-apis-rs/src/rust/lib.rs
Sebastian Thiel 71c827b306 feat(doit): initial part writing
We are a state-machine, and handle parts of it correctly.
However, we don't yet write the boundary at all, and could improve
our use of match.
2015-03-18 17:53:39 +01:00

36 lines
1.0 KiB
Rust

#![feature(core,io)]
#![allow(dead_code)]
//! library with code shared by all generated implementations
extern crate hyper;
extern crate mime;
extern crate "rustc-serialize" as rustc_serialize;
extern crate "yup-oauth2" as oauth2;
// just pull it in the check if it compiles
mod cmn;
/// This module is for testing only, its code is used in mako templates
#[cfg(test)]
mod tests {
extern crate "yup-hyper-mock" as hyper_mock;
use super::cmn::*;
use self::hyper_mock::*;
use std::io::Read;
use std::default::Default;
#[test]
fn multi_part_reader() {
let mut r1 = MockStream::with_input(b"foo");
let mut r2 = MockStream::with_input(b"bar");
let mut mpr: MultiPartReader = Default::default();
mpr.add_part(&mut r1, 50, &"application/json".parse().unwrap())
.add_part(&mut r2, 25, &"application/plain".parse().unwrap());
let mut res = String::new();
assert_eq!(mpr.read_to_string(&mut res), Ok(57));
println!("{}", res);
assert!(false);
}
}