# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
from __future__ import print_function

import sys
import unittest
import os
sys.path.insert(0, '../')

import format
from formattedText import FormattedText
import parse

fileTestCases = [{
    'input': 'html/js/hotness.js',
    'match': True,
    'file': 'html/js/hotness.js'
}, {
    'input': '/absolute/path/to/something.txt',
    'match': True,
    'file': '/absolute/path/to/something.txt'
}, {
    'input': '/html/js/hotness.js42',
    'match': True,
    'file': '/html/js/hotness.js42'
}, {
    'input': '/html/js/hotness.js',
    'match': True,
    'file': '/html/js/hotness.js'
}, {
    'input': './asd.txt:83',
    'match': True,
    'file': './asd.txt',
    'num': 83
}, {
    'input': '.env.local',
    'match': True,
    'file': '.env.local'
}, {
    'input': '.gitignore',
    'match': True,
    'file': '.gitignore'
}, {
    'input': 'tmp/.gitignore',
    'match': True,
    'file': 'tmp/.gitignore'
}, {
    'input': '.ssh/.gitignore',
    'match': True,
    'file': '.ssh/.gitignore'
}, {
    'input': '.ssh/known_hosts',
    'match': True,
    'file': '.ssh/known_hosts'

    # For now, don't worry about matching the following case perfectly,
    # simply because it's complicated.
    #}, {
    #    'input': '~/.ssh/known_hosts',
    #    'match': True,

}, {
    # Arbitrarily ignore really short dot filenames
    'input': '.a',
    'match': False,
}, {
    'input': 'flib/asd/ent/berkeley/two.py-22',
    'match': True,
    'file': 'flib/asd/ent/berkeley/two.py',
    'num': 22
}, {
    'input': 'flib/foo/bar',
    'match': True,
    'file': 'flib/foo/bar'
}, {
    'input': 'flib/foo/bar ',  # note space
    'match': True,
    'file': 'flib/foo/bar'
}, {
    'input': 'foo/b ',
    'match': True,
    'file': 'foo/b'
}, {
    'input': 'foo/bar/baz/',