コード例 #1
0
        public void TestDirectoryBasedCtorArgumentValidation()
        {
            AssertThrows <ArgumentException>(
                () => Runfiles.CreateDirectoryBasedForTesting(null));

            AssertThrows <ArgumentException>(() => Runfiles.CreateDirectoryBasedForTesting(""));

            AssertThrows <ArgumentException>(
                () => Runfiles.CreateDirectoryBasedForTesting("non-existent directory is bad"));

            Runfiles.CreateDirectoryBasedForTesting(BazelEnvironment.GetTmpDir());
        }
コード例 #2
0
        public void TestDirectoryBasedRlocation()
        {
            // The DirectoryBased implementation simply joins the runfiles directory and the runfile's path
            // on a "/". DirectoryBased does not perform any normalization, nor does it check that the path
            // exists.
            var dir = Path.Combine(BazelEnvironment.GetTmpDir() !, "mock/runfiles");

            Directory.CreateDirectory(dir).Exists.Should().Be(true);

            var r = Runfiles.CreateDirectoryBasedForTesting(dir);

            // Escaping for "\": once for string and once for regex.
            r.Rlocation("arg").Should().MatchRegex(@".*[/\\]mock[/\\]runfiles[/\\]arg");
        }