Skip to content

Commit c17240d

Browse files
committed
the first actual assetion (#293)
1 parent d4b3a07 commit c17240d

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

git-index/src/file.rs

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
mod impls {
2+
use crate::{File, State};
3+
use std::ops::{Deref, DerefMut};
4+
5+
impl Deref for File {
6+
type Target = State;
7+
8+
fn deref(&self) -> &Self::Target {
9+
&self.state
10+
}
11+
}
12+
13+
impl DerefMut for File {
14+
fn deref_mut(&mut self) -> &mut Self::Target {
15+
&mut self.state
16+
}
17+
}
18+
}
19+
120
pub mod init {
221
#![allow(unused)]
322

git-index/src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ pub mod file;
99

1010
pub(crate) mod extension;
1111

12+
mod access {
13+
use crate::{State, Version};
14+
15+
impl State {
16+
pub fn version(&self) -> Version {
17+
self.version
18+
}
19+
}
20+
}
21+
1222
pub mod init {
1323
use filetime::FileTime;
1424

git-index/tests/file/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
mod init {
2+
use git_index::Version;
3+
24
fn file(name: &str) -> git_index::File {
35
git_index::File::at(crate::index_fixture_path(name), git_hash::Kind::Sha1).unwrap()
46
}
57

68
#[test]
79
fn read_v2() {
8-
let _file = file("v2");
10+
let file = file("v2");
11+
assert_eq!(file.version(), Version::V2);
912
}
1013
}

0 commit comments

Comments
 (0)