Permalink
Browse files

Refactor Git2.Repository and winxed tests

  • Loading branch information...
1 parent 5a71fec commit 8ae4454474d9fb3b9992821c750336ec9e3c3e26 @leto leto committed Oct 29, 2011
Showing with 11 additions and 8 deletions.
  1. +7 −3 src/Git2/Repository.winxed
  2. +4 −5 t/winxed/001_load.t
View
10 src/Git2/Repository.winxed
@@ -43,8 +43,8 @@ struct git_repository {
class Git2.Repository {
var ptr;
- function Repository() {
- var repo_sv = new 'StructView'([ DATATYPE_STRUCT, 9,
+ function get_sv() {
+ var sv = new 'StructView'([ DATATYPE_STRUCT, 9,
DATATYPE_PTR,
DATATYPE_SIZED, git_cache.size(), git_cache.align(),
DATATYPE_SIZED, git_refcache.size(), git_refcache.align(),
@@ -55,6 +55,10 @@ class Git2.Repository {
DATATYPE_UINT,
DATATYPE_UINT
]);
- self.ptr = repo_sv.alloc();
+ while (1) { yield(sv); }
+ }
+ function Repository() {
+ var sv = get_sv();
+ self.ptr = sv.alloc();
}
}
View
9 t/winxed/001_load.t
@@ -36,20 +36,19 @@ class Test_git2_repository_open {
}
function open_repo() {
- using Git2.ptr.git_repository_open;
+ using Git2.Repository;
using cstring;
var repo = new Git2.Repository;
- var rc;
- rc = git_repository_open(repo.ptr, cstring(".git"));
+ var rc = git_repository_open(repo.ptr, cstring(".git"));
self.assert.equal(rc,0);
}
function repository_index() {
- using Git2.ptr.git_repository_open;
- using Git2.ptr.git_repository_index;
+ using Git2.Repository;
+ using Git2.Index;
using cstring;
var repo = new Git2.Repository;

0 comments on commit 8ae4454

Please sign in to comment.