Visitar URL original
Support printing values without Abseil · Issue #1531 · google/fuzztest · GitHub
Skip to content

Support printing values without Abseil #1531

Open

Description

@tlively

I'm experimenting with using FuzzTest in https://github.com/webassembly/binaryen. We already use GoogleTest, but we don't use Abseil. Like FuzzTest, GoogleTest supports extensible printing using AbslStringify, but it also supports printing via user implementations of PrintTo or <<. Since our codebase does not use Abseil, implementing AbslStringify for our types is not an attractive option, so it would be great if FuzzTest supported printing via PrintTo or << like GoogleTest. Without this, failing fuzz tests cannot usefully report the arguments that made them fail, which makes the fuzz tests themselves much less useful.

Activity

  1. tlively commented on Jan 24, 2025

    @tlively
    Author

    For anyone else in the same situation, here is a catch-all workaround that implements AbslStringify for anything that implements <<:

    template<typename T> constexpr bool type_exists = true;
    
    template<typename Sink, typename T>
    void AbslStringify(
      Sink& sink,
      const T& val,
      std::enable_if_t<type_exists<decltype(std::cout << val)>, bool> = false) {
      std::stringstream ss;
      ss << val;
      sink.Append(ss.str());
    }
    
    

    Of course it would be nice if we didn't need this workaround :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions