Skip to content

Commit

Permalink
Merge pull request #120 from dbrgn/cleanup
Browse files Browse the repository at this point in the history
Remove redundant async tests, do some cleanup
  • Loading branch information
dbrgn committed May 30, 2024
2 parents 2219ed2 + 8627c77 commit d1e353c
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 512 deletions.
26 changes: 13 additions & 13 deletions src/eh0/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ mod test {
let expectations = [Transaction::read(0xaa, vec![1, 2])];
let mut i2c = Mock::new(&expectations);

let mut buff = vec![0; 2];
i2c.read(0xaa, &mut buff).unwrap();
assert_eq!(vec![1, 2], buff);
let mut buf = vec![0; 2];
i2c.read(0xaa, &mut buf).unwrap();
assert_eq!(vec![1, 2], buf);

i2c.done();
}
Expand All @@ -315,9 +315,9 @@ mod test {
let mut i2c = Mock::new(&expectations);

let v = vec![1, 2];
let mut buff = vec![0; 2];
i2c.write_read(0xaa, &v, &mut buff).unwrap();
assert_eq!(vec![3, 4], buff);
let mut buf = vec![0; 2];
i2c.write_read(0xaa, &v, &mut buf).unwrap();
assert_eq!(vec![3, 4], buf);

i2c.done();
}
Expand Down Expand Up @@ -354,8 +354,8 @@ mod test {
let expectations = [Transaction::read(0xaa, vec![10, 12])];
let mut i2c = Mock::new(&expectations);

let mut buff = vec![0; 2];
let _ = i2c.write(0xaa, &mut buff);
let mut buf = vec![0; 2];
let _ = i2c.write(0xaa, &mut buf);
}

#[test]
Expand All @@ -365,8 +365,8 @@ mod test {
let mut i2c = Mock::new(&expectations);

let v = vec![1, 2];
let mut buff = vec![0; 2];
let _ = i2c.write_read(0xaa, &v, &mut buff);
let mut buf = vec![0; 2];
let _ = i2c.write_read(0xaa, &v, &mut buf);
}

#[test]
Expand Down Expand Up @@ -395,9 +395,9 @@ mod test {
let mut i2c_clone = i2c.clone();

// Read on the original mock
let mut buff = vec![0; 2];
i2c.read(0xaa, &mut buff).unwrap();
assert_eq!(vec![1, 2], buff);
let mut buf = vec![0; 2];
i2c.read(0xaa, &mut buf).unwrap();
assert_eq!(vec![1, 2], buf);

// Write on the clone
i2c_clone.write(0xbb, &[3, 4]).unwrap();
Expand Down
Loading

0 comments on commit d1e353c

Please sign in to comment.