All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.scalactic.DeprecatedPrettyMethods.scala Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2001-2013 Artima, Inc.
 *
 * 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.scalactic

/**
 *
 * This trait is the 2.2.6 PrettyMethods trait renamed to DeprecatedPrettyMethods. It is
 * a quick way to get old code working again that defined an implicit PrettifierConfig, but
 * before the deprecation cycle is over please change the implicit PrettifierConfig to
 * an implicit Prettifier.
 * Provides an implicit conversion that enables pretty to be invoked on any
 * object, to transform that object into a String representation.
 */
@deprecated("Please use PrettyMethods instead.")
trait DeprecatedPrettyMethods {

  /**
   * This class is deprecated and will be removed in a future version of ScalaTest. Please use an
   * implicit Prettifier and PrettyMethods instead.
   *
   * Wraps a Prettifier.
   *
   * 

* This class exists so that instances of PrettifierConfig can be made implicit instead * of Prettifer. Because Prettifier is a Any => String, * making it implicit could result in unintentional applications. *

* * @param prettifier the configured Prettifier */ @deprecated("Please use Prettifer and PrettyMethods instead.") case class PrettifierConfig(prettifier: Prettifier) /** * An implicit PrettifierConfig that contains a Prettifier.default. * *

* Subclasses can override this method with a different implicit method to have pretty * use a different Prettifier. *

*/ implicit val prettifierConfig: PrettifierConfig = PrettifierConfig(Prettifier.default) /** * Implicit class that adds a pretty method to any object. * *

* The constructor of this class, besides taking an object o to prettify, * also takes an implicit PrettifierConfig that the pretty method will use to prettify the * object. *

* * @param o the object to prettify * @param prettifierConfig an implicit PrettifierConfig whose Prettifier will be used * to prettify the passed object o */ implicit class Prettyizer(o: Any)(implicit prettifierConfig: PrettifierConfig) { /** * Returns a pretty String representation of the object o */ def pretty: String = prettifierConfig.prettifier(o) } } /** * This object is the 2.2.6 PrettyMethods object renamed to DeprecatedPrettyMethods. Please change * DeprecatedPrettyMethods to PrettyMethods, as DeprecatedPrettyMethods is deprecated and will be removed * in a future version of ScalaTest. */ @deprecated("Please use PrettyMethods instead.") object DeprecatedPrettyMethods extends DeprecatedPrettyMethods




© 2015 - 2025 Weber Informatics LLC | Privacy Policy