Пример #1
0
func (s *nomsShowTestSuite) TestNomsShow() {
	datasetName := "dsTest"
	str := test_util.CreateValueSpecString("ldb", s.LdbDir, datasetName)
	sp, err := spec.ParseDatasetSpec(str)
	d.Chk.NoError(err)
	ds, err := sp.Dataset()
	d.Chk.NoError(err)

	s1 := types.String("test string")
	r := writeTestData(ds, s1)
	s.Equal(res1, s.Run(main, []string{str}))

	spec1 := test_util.CreateValueSpecString("ldb", s.LdbDir, r.TargetHash().String())
	s.Equal(res2, s.Run(main, []string{spec1}))

	ds, err = sp.Dataset()
	list := types.NewList(types.String("elem1"), types.Number(2), types.String("elem3"))
	r = writeTestData(ds, list)
	s.Equal(res3, s.Run(main, []string{str}))

	spec1 = test_util.CreateValueSpecString("ldb", s.LdbDir, r.TargetHash().String())
	s.Equal(res4, s.Run(main, []string{spec1}))

	ds, err = sp.Dataset()
	_ = writeTestData(ds, s1)
	s.Equal(res5, s.Run(main, []string{str}))
}
Пример #2
0
func testCommitInResults(s *nomsShowTestSuite, str string, i int) {
	sp, err := spec.ParseDatasetSpec(str)
	s.NoError(err)
	ds, err := sp.Dataset()
	s.NoError(err)
	ds, err = ds.Commit(types.Number(i))
	s.NoError(err)
	commit := ds.Head()
	ds.Database().Close()
	s.Contains(s.Run(main, []string{str}), commit.Hash().String())
}
Пример #3
0
func (s *nomsShowTestSuite) TestNomsLog() {
	datasetName := "dsTest"
	str := test_util.CreateValueSpecString("ldb", s.LdbDir, datasetName)
	sp, err := spec.ParseDatasetSpec(str)
	s.NoError(err)

	ds, err := sp.Dataset()
	s.NoError(err)
	ds.Database().Close()
	s.Panics(func() { s.Run(main, []string{str}) })

	testCommitInResults(s, str, 1)
	testCommitInResults(s, str, 2)
}