chromium/third_party/abseil-cpp/absl/debugging/internal/demangle_rust_test.cc

// Copyright 2024 The Abseil Authors
//
// 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
//
//     https://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.

#include "absl/debugging/internal/demangle_rust.h"

#include <cstddef>
#include <string>

#include "gtest/gtest.h"
#include "absl/base/config.h"

namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
namespace {

// If DemangleRustSymbolEncoding(mangled, <buffer with room for buffer_size
// chars>, buffer_size) returns true and seems not to have overrun its output
// buffer, returns the string written by DemangleRustSymbolEncoding; otherwise
// returns an error message.
std::string ResultOfDemangling(const char* mangled, size_t buffer_size) {}

// Tests that DemangleRustSymbolEncoding converts mangled into plaintext given
// enough output buffer space but returns false and avoids overrunning a buffer
// that is one byte too short.
//
// The lambda wrapping allows ASSERT_EQ to branch out the first time an
// expectation is not satisfied, preventing redundant errors for the same bug.
//
// We test first with excess space so that if the algorithm just computes the
// wrong answer, it will be clear from the error log that the bounds checks are
// unlikely to be the code at fault.
#define EXPECT_DEMANGLING(mangled, plaintext)

// Tests that DemangleRustSymbolEncoding rejects the given input (typically, a
// truncation of a real Rust symbol name).
#define EXPECT_DEMANGLING_FAILS(mangled)

// Piping grep -C 1 _R demangle_test.cc into your favorite c++filt
// implementation allows you to verify that the goldens below are reasonable.

TEST(DemangleRust, EmptyDemangling) {}

TEST(DemangleRust, FunctionAtCrateLevel) {}

TEST(DemangleRust, TruncationsOfFunctionAtCrateLevel) {}

TEST(DemangleRust, VendorSuffixes) {}

TEST(DemangleRust, UnicodeIdentifiers) {}

TEST(DemangleRust, FunctionInModule) {}

TEST(DemangleRust, FunctionInFunction) {}

TEST(DemangleRust, ClosureInFunction) {}

TEST(DemangleRust, ClosureNumbering) {}

TEST(DemangleRust, ClosureNumberOverflowingInt) {}

TEST(DemangleRust, UnexpectedlyNamedClosure) {}

TEST(DemangleRust, ItemNestedInsideClosure) {}

TEST(DemangleRust, Shim) {}

TEST(DemangleRust, UnknownUppercaseNamespace) {}

TEST(DemangleRust, NestedUppercaseNamespaces) {}

TEST(DemangleRust, TraitDefinition) {}

TEST(DemangleRust, BasicTypeNames) {}

TEST(DemangleRust, SliceTypes) {}

TEST(DemangleRust, ImmutableReferenceTypes) {}

TEST(DemangleRust, MutableReferenceTypes) {}

TEST(DemangleRust, ConstantRawPointerTypes) {}

TEST(DemangleRust, MutableRawPointerTypes) {}

TEST(DemangleRust, TupleLength0) {}

TEST(DemangleRust, TupleLength1) {}

TEST(DemangleRust, TupleLength2) {}

TEST(DemangleRust, TupleLength3) {}

TEST(DemangleRust, LongerTuplesAbbreviated) {}

TEST(DemangleRust, PathBackrefToCrate) {}

TEST(DemangleRust, PathBackrefToNestedPath) {}

TEST(DemangleRust, PathBackrefAsInstantiatingCrate) {}

TEST(DemangleRust, TypeBackrefsNestedInTuple) {}

TEST(DemangleRust, NoInfiniteLoopOnBackrefToTheWhole) {}

TEST(DemangleRust, NoCrashOnForwardBackref) {}

TEST(DemangleRust, PathBackrefsDoNotRecurseDuringSilence) {}

TEST(DemangleRust, TypeBackrefsDoNotRecurseDuringSilence) {}

TEST(DemangleRust, ConstBackrefsDoNotRecurseDuringSilence) {}

TEST(DemangleRust, ReturnFromBackrefToInputPosition256) {}

TEST(DemangleRust, EmptyGenericArgs) {}

TEST(DemangleRust, OneSimpleTypeInGenericArgs) {}

TEST(DemangleRust, OneTupleInGenericArgs) {}

TEST(DemangleRust, OnePathInGenericArgs) {}

TEST(DemangleRust, LongerGenericArgs) {}

TEST(DemangleRust, BackrefInGenericArgs) {}

TEST(DemangleRust, NestedGenericArgs) {}

TEST(DemangleRust, MonomorphicEntityNestedInsideGeneric) {}

TEST(DemangleRust, ArrayTypeWithSimpleElementType) {}

TEST(DemangleRust, ArrayTypeWithComplexElementType) {}

TEST(DemangleRust, NestedArrayType) {}

TEST(DemangleRust, BackrefArraySize) {}

TEST(DemangleRust, ZeroArraySize) {}

TEST(DemangleRust, SurprisingMinusesInArraySize) {}

TEST(DemangleRust, NumberAsGenericArg) {}

TEST(DemangleRust, NumberAsFirstOfTwoGenericArgs) {}

TEST(DemangleRust, NumberAsSecondOfTwoGenericArgs) {}

TEST(DemangleRust, NumberPlaceholder) {}

TEST(DemangleRust, InherentImplWithoutDisambiguator) {}

TEST(DemangleRust, InherentImplWithDisambiguator) {}

TEST(DemangleRust, TraitImplWithoutDisambiguator) {}

TEST(DemangleRust, TraitImplWithDisambiguator) {}

TEST(DemangleRust, TraitImplWithNonpathSelfType) {}

TEST(DemangleRust, ThunkType) {}

TEST(DemangleRust, NontrivialFunctionReturnType) {}

TEST(DemangleRust, OneParameterType) {}

TEST(DemangleRust, TwoParameterTypes) {}

TEST(DemangleRust, ExternC) {}

TEST(DemangleRust, ExternOther) {}

TEST(DemangleRust, Unsafe) {}

TEST(DemangleRust, Binder) {}

TEST(DemangleRust, AllFnSigFeaturesInOrder) {}

TEST(DemangleRust, LifetimeInGenericArgs) {}

TEST(DemangleRust, EmptyDynTrait) {}

TEST(DemangleRust, SimpleDynTrait) {}

TEST(DemangleRust, DynTraitWithOneAssociatedType) {}

TEST(DemangleRust, DynTraitWithTwoAssociatedTypes) {}

TEST(DemangleRust, DynTraitPlusAutoTrait) {}

TEST(DemangleRust, DynTraitPlusTwoAutoTraits) {}

TEST(DemangleRust, HigherRankedDynTrait) {}

}  // namespace
}  // namespace debugging_internal
ABSL_NAMESPACE_END
}  // namespace absl