New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanups and documentation fixes #100

Merged
merged 13 commits into from Jul 19, 2014

Conversation

Projects
None yet
4 participants
@farcaller
Member

farcaller commented Jul 14, 2014

Notable changes:

  • Better docs handling by rake task (visible in rake -T)
  • Added a few missing docs to PT crate
  • PT API is experimental now
  • Old demos (that are not yet PT-compatible) are renamed, pending either porting or removal
  • Feature guards are going away, removed them from hal, drivers and build system support
  • The above breaks sched, but it's broken anyways due to PT.

@farcaller farcaller self-assigned this Jul 14, 2014

@errordeveloper

This comment has been minimized.

errordeveloper commented on platformtree/test_helpers.rs in aa3822f Jul 15, 2014

is this a line length thing?

This comment has been minimized.

Owner

farcaller replied Jul 15, 2014

Yup.

@errordeveloper

This comment has been minimized.

errordeveloper commented on aa3822f Jul 15, 2014

the commit message doesn't say everything what's being changed...

This comment has been minimized.

Owner

farcaller replied Jul 15, 2014

Right, I toyed with asserts, I'll actually revert this a bit later today, they were broken and are still broken, apparently.

@farcaller farcaller changed the title from Cleanups and documentation fixes for some PT code to Cleanups and documentation fixes Jul 16, 2014

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 16, 2014

@bharrisau

This comment has been minimized.

Contributor

bharrisau commented Jul 16, 2014

Tomorrow.

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 18, 2014

No idea what's wrong with that

/home/travis/build/hackndev/zinc/src/drivers/dht22_pt.rs:91:36: 91:55 error: mismatched types: expected `&<generic #976>` but found `Box<hamcrest::matchers::is::Is<bool,test_helpers::EqualToString<bool>>>` (types differ)
/home/travis/build/hackndev/zinc/src/drivers/dht22_pt.rs:91       assert_that(unsafe{*failed}, is(equal_to(false)));
                                                                                               ^~~~~~~~~~~~~~~~~~~

any ideas?

@bharrisau

This comment has been minimized.

Contributor

bharrisau commented Jul 18, 2014

Hamcrest changes? Sorry, forgot to check this last night. I'll look over it now.

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 18, 2014

I just got a fresh rustc and dropped build and thirdparty. Can you confirm it fails for you as well?

@bharrisau

This comment has been minimized.

Contributor

bharrisau commented Jul 18, 2014

Nope, builds for me. lpc17xx?

@bharrisau

This comment has been minimized.

Contributor

bharrisau commented Jul 18, 2014

Oh, fails on test. Yes - fails for me too.

@bharrisau

This comment has been minimized.

Contributor

bharrisau commented Jul 18, 2014

Yes, the error is that you have defined your own is_equal function instead of using hamcrest's one. It is returning a different value.

@bharrisau

This comment has been minimized.

Contributor

bharrisau commented Jul 18, 2014

Works with

  use builder::Builder;
  use test_helpers::{assert_equal_source, with_parsed};
  use hamcrest::{assert_that,is, equal_to};

  #[test]
  fn builds_lpc17xx_pt() {
    with_parsed("
      timer@timer;
      pin@pin;
      dht@dht22 {
        pin = &pin;
        timer = &timer;
      }", |cx, failed, pt| {
      let mut builder = Builder::new(pt.clone());
      pt.get_by_name("timer").unwrap().set_type_name("T".to_string());
      pt.get_by_name("pin").unwrap().set_type_name("P".to_string());
      super::mutate_pin(&mut builder, cx, pt.get_by_name("dht").unwrap());
      super::build_dht22(&mut builder, cx, pt.get_by_name("dht").unwrap());
      assert_that(unsafe{*failed}, is(equal_to(false)));
      assert_that(builder.main_stmts().len(), is(equal_to(1u)));

      assert_equal_source(builder.main_stmts().get(0),
          "let dht = zinc::drivers::dht22::DHT22::new(&timer, &pin);");

      let pin_node = pt.get_by_name("pin").unwrap();
      assert_that(pin_node.get_string_attr("direction").unwrap(),
          is(equal_to("out".into_string())));
    });
pub path_span: Span,
/// a map of node's attributes.

This comment has been minimized.

@bharrisau

bharrisau Jul 19, 2014

Contributor

Capital 'A'

@@ -54,14 +56,18 @@ impl<T : PartialEq+Show> Matcher<T> for EqualToString<T> {
}
}
/// Like hamcrest's equal_to, but requires the objects to support Show (and has
/// way better logging in case of failure).
pub fn equal_to<T : PartialEq+Show>(expected: T) -> Box<EqualToString<T>> {

This comment has been minimized.

@bharrisau

bharrisau Jul 19, 2014

Contributor

This type signature has to be updated - ujh/hamcrest-rust@05acf76

pub fn equal_to<T : PartialEq+Show>(expected: T) -> Box<EqualToString<T>> {
box EqualToString { expected: expected }
}
/// A helper for equal_to that takes a &str argument.
pub fn equal_to_s(expected: &str) -> Box<EqualToString<String>> {

This comment has been minimized.

@bharrisau

bharrisau Jul 19, 2014

Contributor

This also.

use hal::pin::GPIO;
use hal::spi::SPI;
pub struct ILI9341<'a, S, T, P> {

This comment has been minimized.

@bharrisau

bharrisau Jul 19, 2014

Contributor

Doc comments?

This comment has been minimized.

@farcaller

farcaller Jul 19, 2014

Member

I will be refactoring LCD code next, after adding sched support to PT.

@@ -32,6 +32,6 @@ def self.crate_name(src)
end
digest = Digest::SHA256.hexdigest(crate + '-' + version)[0...8]

This comment has been minimized.

@bharrisau

bharrisau Jul 19, 2014

Contributor

Do you still need to calculate the digest?
You can replace all of this with rustc --print-file-name src

@bharrisau

This comment has been minimized.

Contributor

bharrisau commented Jul 19, 2014

Reviewed. Just a couple of small things, and you need to update the type signatures of your version of equal_to and equal_to_s

@farcaller

This comment has been minimized.

Member

farcaller commented Jul 19, 2014

your version of equal_to and equal_to_s

I've removed them completely.

@farcaller

This comment has been minimized.

Owner

farcaller commented on d02d7d9 Jul 19, 2014

r=bharrisau

@hacknbot

This comment has been minimized.

Contributor

hacknbot commented on d02d7d9 Jul 19, 2014

saw approval from bharrisau
at farcaller@d02d7d9

This comment has been minimized.

Contributor

hacknbot replied Jul 19, 2014

merging farcaller/zinc/cleanups = d02d7d9 into auto

This comment has been minimized.

Contributor

hacknbot replied Jul 19, 2014

farcaller/zinc/cleanups = d02d7d9 merged ok, testing candidate = 76cfbc6

This comment has been minimized.

Contributor

hacknbot replied Jul 19, 2014

This comment has been minimized.

Contributor

hacknbot replied Jul 19, 2014

fast-forwarding master to auto = 76cfbc6

hacknbot added a commit that referenced this pull request Jul 19, 2014

Merge pull request #100 from farcaller/cleanups
Cleanups and documentation fixes

Reviewed-by: bharrisau

@hacknbot hacknbot merged commit d02d7d9 into hackndev:master Jul 19, 2014

2 checks passed

continuous-integration/travis-ci The Travis CI build passed
Details
default all tests passed
Details

@farcaller farcaller deleted the farcaller:cleanups branch Jul 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment