1 // Copyright 2008-2010 Victor Iacoban
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software distributed under
10 // the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
11 // either express or implied. See the License for the specific language governing permissions and
12 // limitations under the License.
13 package org.zmlx.hg4idea.test;
15 import com.intellij.openapi.vfs.VirtualFile;
16 import org.testng.annotations.Test;
19 * Tests adding files to the Mercurial repository.
21 public class HgAddTestCase extends HgAbstractTestCase {
24 * 1. Create a file in the file system.
25 * 2. Add the unversioned file to the VCS using the ChangeListManager.
26 * 3. Verify that the file was added to the VCS.
29 public void fileAddedViaChangeListShouldBeAddedToHg() throws Exception {
30 final VirtualFile vf = myTempDirTestFixture.createFile(AFILE);
31 myChangeListManager.addUnversionedFilesToVcs(vf);
32 verifyStatus(added(AFILE));
33 myChangeListManager.checkFilesAreInList(true, vf);
37 * 1. Create a file in the file system.
38 * 2. Add the file to the VCS using the native command.
39 * 4. Verify that the file is in the default change list.
42 public void fileAddedViaHgShouldBeAddedInChangeList() throws Exception {
43 final VirtualFile vf = createFileInCommand(AFILE, FILE_CONTENT);
44 myChangeListManager.checkFilesAreInList(true, vf);
48 * 1. Create some files and directories in the file system.
49 * 2. Add them to the VCS via the ChangeListManager.
50 * 3. Verify that they are added to the VCS.
53 public void filesInDirsAddedViaChangeListShouldBeAddedToHg() throws Exception {
54 final VirtualFile afile = myTempDirTestFixture.createFile(AFILE);
55 final VirtualFile bdir = myTempDirTestFixture.findOrCreateDir(BDIR);
56 final VirtualFile bfile = myTempDirTestFixture.createFile(BFILE_PATH);
57 myChangeListManager.addUnversionedFilesToVcs(afile, bdir, bfile);
58 verifyStatus(added(AFILE), added(BFILE_PATH));
59 myChangeListManager.checkFilesAreInList(true, afile, bfile);
63 * 1. Create some files and directories in the file system.
64 * 2. Add them to the VCS natively.
65 * 3. Check that they were added to the default change list.
68 public void filesInDirsAddedViaHgShouldBeAddedInChangeList() throws Exception {
69 final VirtualFile afile = createFileInCommand(AFILE, FILE_CONTENT);
70 final VirtualFile bdir = createDirInCommand(myWorkingCopyDir, BDIR);
71 final VirtualFile bfile = createFileInCommand(bdir, BFILE, FILE_CONTENT);
72 verifyStatus(added(AFILE), added(BFILE_PATH));
73 myChangeListManager.checkFilesAreInList(true, afile, bfile);