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.
41 lines
1.1 KiB
41 lines
1.1 KiB
namespace tests
|
|
|
|
open System
|
|
open System.IO
|
|
open Microsoft.VisualStudio.TestTools.UnitTesting
|
|
|
|
open git_guts
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
[<TestClass>]
|
|
type TestStagingIndex () =
|
|
|
|
[<TestInitialize>]
|
|
member this.init () =
|
|
// prepare to run a test
|
|
disableSpectreCapabilities ()
|
|
|
|
[<TestMethod>]
|
|
member this.TestDumpStagingIndex () =
|
|
|
|
let doTest zipFname =
|
|
|
|
// set up the test repo
|
|
use gitTestRepo = new GitTestRepo( zipFname )
|
|
runGitGc gitTestRepo.repoDir
|
|
|
|
// dump the staging index
|
|
using ( new CaptureStdout() ) ( fun cap ->
|
|
dumpStagingIndex gitTestRepo.repoDir false
|
|
let expectedFname =
|
|
let fname = Path.GetFileNameWithoutExtension( zipFname ) + ".staging-index.txt"
|
|
Path.Combine( __SOURCE_DIRECTORY__, "fixtures", fname )
|
|
cap.checkOutput expectedFname
|
|
)
|
|
|
|
// run the tests
|
|
Assert.ThrowsException<Exception>( fun () ->
|
|
doTest "empty.zip"
|
|
) |> ignore
|
|
doTest "simple.zip"
|
|
|