/*
 * Copyright 2013 The jdeb developers.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.vafer.jdeb.ant;

import junit.framework.TestCase;
import org.apache.tools.ant.types.selectors.SelectorUtils;

public final class AntSelectorTestCase extends TestCase {

    private boolean isExcluded( String name, String[] excludes ) {
        for (String exclude : excludes) {
            if (SelectorUtils.matchPath(exclude, name)) {
                return true;
            }
        }
        return false;
    }

    public void testExclusion() throws Exception {
      assertTrue("should be excluded", isExcluded("/some/bin/stuff", new String[]{ "**/bin/**" }));
      assertTrue("should not be excluded", !isExcluded("/some/stuff", new String[]{ "**/bin/**" }));
    }
}

@@ -789,111 +789,88 @@
    p
-rivate boolean isExcluded( String name, String%5B%5D excludes ) %7B%0A        for (String exclude : excludes) %7B
+ublic void testExclusion() throws Exception %7B%0A        assertTrue(%22should match%22,
 %0A   
@@ -882,12 +882,8 @@
     
-if (
 Sele
@@ -906,356 +906,144 @@
 ath(
-exclude, name)) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%0A    public void testExclusion() throws Exception %7B%0A      assertTrue(%22should be excluded%22, isExcluded(%22/some/bin/stuff%22, new String%5B%5D%7B %22**/bin/**%22 %7D));%0A      assertTrue(%22should not be excluded%22, !isExcluded(%22/some/stuff%22, new String%5B%5D%7B %22**/bin/**%22 %7D
+%22**/bin/**%22, %22/some/bin/stuff%22));%0A        assertFalse(%22should not match%22,%0A            SelectorUtils.matchPath(%22**/bin/**%22, %22/some/stuff%22
 ));%0A

test the ant selector