Print string-based diff if there's a mismatch of two strings

オープン
#50 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
clojure
領域
testing-qa

調査の方向性

まず deep-diff2.printer-impl/print-mismatch と既存の mismatch 出力動作を読みます。文字列同士の mismatch をどのように表示するか、複数行の値を含めて、またその動作にオプションが必要かどうかを決めます。既存の consumer を壊さずに、git のような有用な出力が得られれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement good first issue

I sometimes need to write tests for functions that output strings, in particular multi-line strings. Right now deep-diff2 will just say -<expected-string> +<actual-string>, which isn't very useful for longer strings and strings containing newlines.
Right now I try to work around this by splitting the strings on newlines and letting deep-diff2 diff the arrays, which at least will highlight the lines with changes, but it's not great.

I think it'd be useful to print a string-based diff, like git-diff would, if both expressions for a mismatch are string.

For no newlines they could still be printed in place, but for newlines it likely would make sense to introduce a linebreak and then show the diff without worrying about indentation.

I found deep-diff2.printer-impl/print-mismatch, and (and (string? (:- expr)) (string? (:+ expr))) seems like an easy enough condition there, so I'm playing around with it.

Would you consider this for deep-diff2, or do you see problems with the approach? Perhaps it could be an option to not break any existing consumers.

主要言語
Clojure
スター
326
フォーク
18
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lambdaisland/deep-diff2 のほかの issue

lambdaisland/deep-diff2 の issue をすべて見る

似ている issue

Clojure の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。