From patchwork Sun Oct 10 17:03:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Sixt X-Patchwork-Id: 12548665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06F12C4332F for ; Sun, 10 Oct 2021 17:03:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E446C60F58 for ; Sun, 10 Oct 2021 17:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232089AbhJJRFJ (ORCPT ); Sun, 10 Oct 2021 13:05:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231928AbhJJRFH (ORCPT ); Sun, 10 Oct 2021 13:05:07 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30CB9C061745 for ; Sun, 10 Oct 2021 10:03:08 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id e3so14266837wrc.11 for ; Sun, 10 Oct 2021 10:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=bmuO/jMfblS6AyGnS/YriWnEGzghNWl6SYQCUtVvYAM=; b=gP8xOFhZ9/BfRn4RKHF0RA4j9jabYwcJHMqRM5bItXHpXQkl13BWsjKqeHY412ypWW 57H49D/puResBjsh2qV7UZkLXMf7QFdFrTNrHcp3/EY7VDJFZWOrb8LCkcvICK0Lv4OV ogjAZQkqqa2LvgVoUjZi8t5w02kjAMc0/rdzQ+VuXumQkMUjE3y8B0rI1BHdeutM9s69 u4RM+lSOwlhZvwreUUlu/+uYJVs+Mc2kSibxcu5AYwRHgeIg27tRUCy13AjSLEIz+wTb E9d2nhKYegvv3urlDzl7/EKY0dIFXzml0lm2Gfn4Dm3gCnYnWDg5XK3M8E268ZQpvhFd Oryg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=bmuO/jMfblS6AyGnS/YriWnEGzghNWl6SYQCUtVvYAM=; b=RPZ/wIromNv8AJASXaKq4tgpoLEUj4lYi4QpiomI0hU4iThM1TmnApq9tXZSK4ajWG gN95OZsXIjJmY50aYKYhlu2BNKVNe5M4aHHOdVk8eHyK005yqeuQgBI9BkaAgca2AFek hTu7PmTSoREXcMkPCboErCefMxi329Meg1eqP3EgeQZrklTfAq0yK+P5XWeUbaRwMhUy SiDwgdeUNjIPWTHXvKa8YRSA3lV+ZMN3l2UnbOu1WV9my0hj9JwgQI93Qbcf25nhyxxn eOPxivp+b+OZFmE2m6c/L6xlNL4YMnnWZMaskIbzh7cV4XyKrBp45vN12rvbIUA0rlQ2 Icqw== X-Gm-Message-State: AOAM531dWvdLYQiw/FgTu7yfKI+5Im+rhv2kKLjcmli6Ct9T60g8JGre pOgpziyXj3/nD0haMRKhwH9s/NiVSKY= X-Google-Smtp-Source: ABdhPJyh5iBMuJIwzZjf5pJdfyKxgJKb2HBqfJghgrfSpp0rlSbEzcdbjKzJO3++dWs+msJE1mH5fA== X-Received: by 2002:a1c:a401:: with SMTP id n1mr16469255wme.162.1633885386724; Sun, 10 Oct 2021 10:03:06 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t11sm5345651wrz.65.2021.10.10.10.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Oct 2021 10:03:06 -0700 (PDT) Message-Id: <5a84fc9cf715aec258d9cda2dd7d2e8eff2dc66c.1633885384.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 10 Oct 2021 17:03:00 +0000 Subject: [PATCH v3 2/6] t4034: add tests showing problematic cpp tokenizations Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Johannes Sixt , Johannes Sixt Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Sixt From: Johannes Sixt The word regex is too loose and matches long streaks of characters that should actually be separate tokens. Add these problematic test cases. Separate the lines with text that will remain identical in the pre- and post-image so that the diff algorithm will not lump removals and additions of consecutive lines together. This makes the expected output easier to read. Signed-off-by: Johannes Sixt --- t/t4034/cpp/expect | 22 ++++++++++++++++++---- t/t4034/cpp/post | 18 ++++++++++++++++-- t/t4034/cpp/pre | 16 +++++++++++++++- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/t/t4034/cpp/expect b/t/t4034/cpp/expect index 41976971b93..63e53a61e62 100644 --- a/t/t4034/cpp/expect +++ b/t/t4034/cpp/expect @@ -1,11 +1,25 @@ diff --git a/pre b/post -index c5672a2..4229868 100644 +index 1229cdb..3feae6f 100644 --- a/pre +++ b/post -@@ -1,16 +1,16 @@ -Foo() : x(0&&1&42) { bar(x); } +@@ -1,30 +1,30 @@ +Foo() : x(0&&1&42) { foo0bar(x.f.Find); } cout<<"Hello World!?\n"<(1) (-1e10) (0xabcdef) 'xy' +(1 -1e10+1e10 0xabcdef) 'xy' +// long double +3.141592653e-10l3.141592654e+10l +// float +120E5fE6f +// hex +0xdeadbeaf+80xdeadBeaf+7ULL +// octal +0123456701234560 +// binary +0b10000b1100+e1 +// expression +1.5-e+2+f1.5-e+3+f +// another one +str.e+65.e+75 [a] b->->*v d.e.*e ~!a !~b c+++ d--- e**f g&&&h a**=b c//=d e%%=f diff --git a/t/t4034/cpp/post b/t/t4034/cpp/post index 4229868ae62..3feae6f430f 100644 --- a/t/t4034/cpp/post +++ b/t/t4034/cpp/post @@ -1,6 +1,20 @@ -Foo() : x(0&42) { bar(x); } +Foo() : x(0&42) { bar(x.Find); } cout<<"Hello World?\n"<*v d.*e ~!a !~b c+ d- e**f g&&h a*=b c/=d e%=f diff --git a/t/t4034/cpp/pre b/t/t4034/cpp/pre index c5672a24cfc..1229cdb59d1 100644 --- a/t/t4034/cpp/pre +++ b/t/t4034/cpp/pre @@ -1,6 +1,20 @@ -Foo():x(0&&1){} +Foo():x(0&&1){ foo0( x.find); } cout<<"Hello World!\n"<v d.e !a ~b c++ d-- e*f g&h a*b c/d e%f