mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 06:47:41 +03:00
06bf5ea5c4
Summary: Refactors `glob_test` and `casing_test` to run with every possible case sensitivity setting (sensitive, insensitive, and OS-determined) on every platform where we run the tests. More generally, any integration test can now be decorated with `testcase.eden_repo_test(case_sensitivity_dependent=True)` to get the same behaviour. This makes it easier to iterate on case-(in)sensitivity features while developing Eden on a single machine/OS (that may or may not be case-sensitive itself), and removes the hacky OS sniffing that we were previously doing for `glob_test` and `casing_test` in favour of always asking Eden what the real case-sensitivity setting is. This is powered by the CLI changes in D40180643. Reviewed By: xavierd Differential Revision: D40180642 fbshipit-source-id: e3dadd274e3b82dc7e6ebf465ae70287ea623594
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
import os
|
|
|
|
from .lib import testcase
|
|
|
|
|
|
@testcase.eden_repo_test(case_sensitivity_dependent=True)
|
|
class CasingTest(testcase.EdenRepoTest):
|
|
"""Verify that EdenFS behave properly when configured to be case
|
|
insensitive and case preserving.
|
|
"""
|
|
|
|
def populate_repo(self) -> None:
|
|
self.repo.write_file("adir1/adir2/a", "Hello!\n")
|
|
self.repo.commit("a")
|
|
|
|
def test_insensitive(self) -> None:
|
|
if not self.is_case_sensitive:
|
|
self.assertEqual(self.read_file("adir1/adir2/A"), "Hello!\n")
|
|
|
|
def test_case_preserving(self) -> None:
|
|
if not self.is_case_sensitive:
|
|
self.assertEqual(self.read_file("adir1/adir2/A"), "Hello!\n")
|
|
self.assertEqual(os.listdir(self.get_path("adir1/adir2")), ["a"])
|
|
|
|
def test_case_preserving_new_files(self) -> None:
|
|
if not self.is_case_sensitive:
|
|
self.write_file("MixedCaseFile", "content\n")
|
|
self.assertIn("MixedCaseFile", os.listdir(self.get_path("")))
|