File tree 3 files changed +33
-1
lines changed
3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change
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
+
1
20
pub mod init {
2
21
#![ allow( unused) ]
3
22
Original file line number Diff line number Diff line change @@ -9,6 +9,16 @@ pub mod file;
9
9
10
10
pub ( crate ) mod extension;
11
11
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
+
12
22
pub mod init {
13
23
use filetime:: FileTime ;
14
24
Original file line number Diff line number Diff line change 1
1
mod init {
2
+ use git_index:: Version ;
3
+
2
4
fn file ( name : & str ) -> git_index:: File {
3
5
git_index:: File :: at ( crate :: index_fixture_path ( name) , git_hash:: Kind :: Sha1 ) . unwrap ( )
4
6
}
5
7
6
8
#[ test]
7
9
fn read_v2 ( ) {
8
- let _file = file ( "v2" ) ;
10
+ let file = file ( "v2" ) ;
11
+ assert_eq ! ( file. version( ) , Version :: V2 ) ;
9
12
}
10
13
}
You can’t perform that action at this time.
0 commit comments