diff options
Diffstat (limited to 'lib/private/truth_common.bzl')
-rw-r--r-- | lib/private/truth_common.bzl | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/private/truth_common.bzl b/lib/private/truth_common.bzl index c7e6b60..1916901 100644 --- a/lib/private/truth_common.bzl +++ b/lib/private/truth_common.bzl @@ -1,3 +1,17 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# 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. + """Common code used by truth.""" load("@bazel_skylib//lib:types.bzl", "types") @@ -16,6 +30,8 @@ def _informative_str(value): value_str = str(value) if not value_str: return "<empty string ∅>" + elif "\n" in value_str: + return '"""{}""" <sans triple-quotes; note newlines and whitespace>'.format(value_str) elif value_str != value_str.strip(): return '"{}" <sans quotes; note whitespace within>'.format(value_str) else: @@ -84,7 +100,7 @@ def maybe_sorted(container, allow_sorting = True): Args: container: ([`list`] | (or other object convertible to list)) allow_sorting: ([`bool`]) whether to sort even if it can be sorted. This - is primarly so that callers can avoid boilerplate when they have + is primarily so that callers can avoid boilerplate when they have a "should it be sorted" arg, but also always convert to a list. Returns: |