File: namespaces.c

package info (click to toggle)
libgit2 0.27.7%2Bdfsg.1-0.2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 31,400 kB
  • sloc: ansic: 157,824; sh: 406; python: 182; php: 65; makefile: 61
file content (36 lines) | stat: -rw-r--r-- 914 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "clar_libgit2.h"

#include "repository.h"

static git_repository *g_repo;

void test_refs_namespaces__initialize(void)
{
	g_repo = cl_git_sandbox_init("testrepo");
}

void test_refs_namespaces__cleanup(void)
{
	cl_git_sandbox_cleanup();
}

void test_refs_namespaces__get_and_set(void)
{
	cl_assert_equal_s(NULL, git_repository_get_namespace(g_repo));

	cl_git_pass(git_repository_set_namespace(g_repo, "namespace"));
	cl_assert_equal_s("namespace", git_repository_get_namespace(g_repo));

	cl_git_pass(git_repository_set_namespace(g_repo, NULL));
	cl_assert_equal_s(NULL, git_repository_get_namespace(g_repo));
}

void test_refs_namespaces__namespace_doesnt_show_normal_refs(void)
{
	static git_strarray ref_list;

	cl_git_pass(git_repository_set_namespace(g_repo, "namespace"));
	cl_git_pass(git_reference_list(&ref_list, g_repo));
	cl_assert_equal_i(0, ref_list.count);
	git_strarray_free(&ref_list);
}