changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / rust/lib/obj/src/object.rs

changeset 698: 96958d3eb5b0
parent: 0ccbbd142694
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 //! obj::object
2 //!
3 //! Concrete object types and traits. All type definitions conform to
4 //! the Serde spec.
5 pub mod color;
6 pub mod contact;
7 pub mod direction;
8 pub mod doc;
9 pub mod location;
10 pub mod media;
11 pub mod meta;
12 pub mod temperature;
13 
14 #[cfg(test)]
15 mod test {
16  use super::*;
17  use crate::Objective;
18  use std::{fs, str::FromStr};
19  #[test]
20  fn test_location_points() {
21  let pnt = location::Point::new(1.0, 2.0);
22  assert_eq!(
23  String::from_str("(\n lat: 1.0,\n lng: 2.0,\n)").unwrap(),
24  pnt.to_ron_string().unwrap()
25  );
26  assert_eq!(
27  location::Point::from_ron_str("(lat: 1.0, lng: 2.0)").unwrap(),
28  pnt
29  );
30  }
31 
32  /// test file metadata
33  #[test]
34  fn test_basic_file_metadata() {
35  let attr = fs::metadata("Cargo.toml").unwrap();
36  println!("{:?}", attr);
37  }
38 
39  #[test]
40  fn test_docs() {
41  let doc = doc::Doc::default();
42  assert_eq!(doc.extension, doc::DocExtension::from_str("org").unwrap());
43  }
44 
45  #[test]
46  fn test_media() {
47  let media = media::Media::new("test_media", "wav");
48  assert_eq!(
49  media.extension,
50  media::MediaExtension::from_str("wav").unwrap()
51  );
52  }
53 }