A deep dive into git internals.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
git-guts-fs/git-guts/tests/TestRefs.fs

48 lines
1.4 KiB

namespace tests
open System
open System.IO
open Microsoft.VisualStudio.TestTools.UnitTesting
open git_guts
// --------------------------------------------------------------------
[<TestClass>]
type TestRefs () =
[<TestInitialize>]
member this.init () =
// prepare to run a test
disableSpectreCapabilities ()
[<TestMethod>]
member this.TestDumpRefs () =
let doTest zipFname =
// set up the test repo
use gitTestRepo = new GitTestRepo( zipFname )
// dump the refs
using ( new CaptureStdout() ) ( fun cap ->
dumpRefs gitTestRepo.repoDir
let expectedFname =
let fname = Path.GetFileNameWithoutExtension( zipFname ) + ".refs.txt"
Path.Combine( __SOURCE_DIRECTORY__, "fixtures", fname )
checkCapturedOutput cap expectedFname
)
// move the loose objects to a pack, and check again
runGitGc gitTestRepo.repoDir
using ( new CaptureStdout() ) ( fun cap ->
dumpRefs gitTestRepo.repoDir
let expectedFname =
let fname = Path.GetFileNameWithoutExtension( zipFname ) + ".refs-packed.txt"
Path.Combine( __SOURCE_DIRECTORY__, "fixtures", fname )
checkCapturedOutput cap expectedFname
)
// run the tests
doTest "empty.zip"
doTest "full2.zip"