From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29785 invoked from network); 7 Feb 2023 03:25:40 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Feb 2023 03:25:40 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1675740340; b=nxaXgxtxZqadd9XvXFgMoR6KfUYwty7bE98vFMj0wcj+TEosS78fA70tRUVJ37WCvd7jVOUk7A V+asdSkdTXawwzpVUine9MdKpuAckslC5FaCfxQ+ACML4R2hC93Uy3W4Elq3NBUETiGUnqjebx HmyAaKqEkP9sLUlPKo03QHtICqpnjIq5ioPBgIV+JbTMc9SSScI2crWPb13iVHKTGKIuFj8nGS y3ObpbCrsEz/YbL2Ysi8lNjjYhHi4rK7D0dPeCMy+XRAacCBSN3WVcHnAFARTYWFmjH6jNnDZH pIG0PSOKAUzWS0FM4gRb6LlxQXFb1TsyGZPwOBOUKiKTFw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f48.google.com) smtp.remote-ip=209.85.208.48; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1675740340; bh=nFXhlvFFlp5rhwRo6yn22eO5kG8FATSEbh8poYpGPes=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=pOy/2qBmmWQR0Op7uDxCNw2Blpz/k7Gjo3pclzZYYy3L4Q7SajRvqo7VOU8tNe6hh/Jczl1j4k DLlasQASQeYubBxwJLBysxMPMlXylCQ3FXkq+twbgPApJrZyQpIqZQMF7R+l0+aI4vIIQCAO5M bH/Kc8Axgr476uVOePQ+2EBJynS+pZWxcpJdgoUzWpyX09U2AuOk8oK3KMkC6k07nDq4xazH9d tx2pohizqotEwPPXoIhGlgQCmDvoxvRSOpFWZZFYIQzkmuu9jV7aY0YaSGJSVuZ9BguWjK7xnN d5B/62MVkT+XCDsHHIV/y9N5rkbWtt6hHLj0I8FevZUy3g==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=MYbO5kVHqtp8focwA44tN3q+jw8awB8qi/PHlFc6kXs=; b=bmzYSkO2IswCd5gGDogeIWWzJe PUmpmWWpTFnUB94/RoBvnRdQBGtXpX2cDwEbK2k5mMxa0m8UQwGsJAbfO5cESw/SMJIILF52MVtr0 rFfkSRCXRi3BLxLfqKhXZsjwzjUvnpA8GBeFihJn56tS24kAnVoR8NVUpUtx30/duESIdZvB3R1X7 mdTnyPSHRiGcr9rjc+4c+JMBFG9/cSHQmaSG/e9wX+xQlCxbu5u7r5t+YErjAiki81UPGVDnH/rgw aQBCV0+lvN73JmjlOLS8ngzqlP0TJngU6MofsNgAnqOwsfg4BodL5Y730g4dTIGb3jVxPXx7XQn3r PaIo0uqA==; Received: by zero.zsh.org with local id 1pPEbz-00059A-F5; Tue, 07 Feb 2023 03:25:39 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f48.google.com) smtp.remote-ip=209.85.208.48; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f48.google.com ([209.85.208.48]:43522) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pPEbP-0004oK-Vf; Tue, 07 Feb 2023 03:25:05 +0000 Received: by mail-ed1-f48.google.com with SMTP id m8so13731589edd.10 for ; Mon, 06 Feb 2023 19:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MYbO5kVHqtp8focwA44tN3q+jw8awB8qi/PHlFc6kXs=; b=2nVzWYE//Qfu8GslJKBFOi44n9fpIEeZ5B/DY0+ckE+WGzDxS4+tknOrucFR85FRl+ VQs3nE8ptAAplqCZEQ4JEbFm9dzq58QiZNnh3IWFE4XSJ4jCayNestEN5ZSUA+55Rjvf Zuc0AKJx70XGQcBbbq6w7JknCvs9LWv2ELccxiQXN3FU0LcL/Q0Jic69v/UJYOOMWVV5 iJrYcSbf6QhwrIoAywb3eO4JBHQfssT2/yntnU1qzmdE5JRaQXG/y8q3c4kwFNHvw7Ju wf1P3x0d9YuA2hPtw4698Bc2C5J9x9dxfM5NXTAgfgC03zoK3GnnBIm7B+wWaRDnuZWJ rpJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MYbO5kVHqtp8focwA44tN3q+jw8awB8qi/PHlFc6kXs=; b=GuOaKn1aDUNZ/dSNRCk1scibcwnMIh2yKLrI9KB5AsRha+4aagYmv4X5iXiOKIsPUQ 1GhuowpJHaa5XtR6JFWpjpbuC7AdoDwi/XB3k5+ikRBovXV8qzy1Ktyhq/fbj1FU1rnn qt70SyfQy2ktiomkWrztsxKmQKL8kRefoMZntA6OIbzK+Ew2dZmpSKKQwXAconrMQJKv XSeMkWmUz2WlDfzay8j4z8ugV7qHFzrLyKMUtxJ06Lp67GCYq020X1l+PwhpuHn7hHdg Z0/Ri4gC/ySFHm4GPboHhNtaP09JsSbGj7hTewqmXsoqkPmJ6WsS4imFe1ze8QAs61Xz tx1w== X-Gm-Message-State: AO0yUKUHYofkSDbENx6AUDuIJmw7AXcpKX33wMs9mUfgClEef+go0nNd ekcZMx2TjcZoSF/gc/mYIeR2Pj79E1fSFNQB1/Lk28kZ7CGXLQ== X-Google-Smtp-Source: AK7set9TzP0SB4vNjD1Mv0pQMEhVLXVkFtkCyW4OGtZf45qSPy7uSIF4QTqBkTxwuLWl5wGq3sLBZR7BQO70Ec4ygVU= X-Received: by 2002:a50:d59d:0:b0:4a0:902c:9da2 with SMTP id v29-20020a50d59d000000b004a0902c9da2mr483950edi.62.1675740303449; Mon, 06 Feb 2023 19:25:03 -0800 (PST) MIME-Version: 1.0 References: <20230207003355.GB4460@tarpaulin.shahaf.local2> In-Reply-To: <20230207003355.GB4460@tarpaulin.shahaf.local2> From: Bart Schaefer Date: Mon, 6 Feb 2023 19:24:52 -0800 Message-ID: Subject: Re: [PATCH 2/3] Tests for named references To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 51369 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Mon, Feb 6, 2023 at 4:36 PM Daniel Shahaf wrote= : > > Bart Schaefer wrote on Sun, Feb 05, 2023 at 18:24:58 -0800: ]> > +++ b/Test/K01nameref.ztst > > Add "K:" to Test/README? Forgot that file even existed. Added. > > +# Tests for the zsh/param/private module > > Copy-pasto. Fixed. > > + typeset -n ptr=3Dvar > > + typeset var=3Dvalue > > + unset ptr > > + typeset -p var > > +0:unset via nameref > > + > > So this expects =C2=ABtypeset -p var=C2=BB to return 0 and have no output= . Are > these the correct expectations? Matches ksh93 to the best of my ability to test. > > > + typeset -n ptr2=3D'path[2]' > > + print -r -- $ptr2 > > +0d:nameref to array element > > +>${path[2]} > > + > > Did you mean "0q" rather than "0d"? Indeed I did. Changed. > How about tests for assigning to a nameref-to-hash? (Entire hash, not > hash element) Or are these implied by the "assign to array" and "expand > nameref-to-hash" tests. I believe they are so implied. > Also, in 1/3 you wrote "attempting to add an attribute to a named > reference generates a warning", but I don't see a single test expecting > a non-empty stderr? Not sure what you mean here, there are lots of tests that expect a zero exit status and check output only on stdout. The fifth test specifically attempts adding the "tag" attribute to a named reference and looks for the expected warning. In a number of cases I'm checking that the state of variables has been restored to the expected state by looking for both correct stdout of the earlier steps and "no such variable" after the test is done, the intent being to catch any cases where the nameref goes too far up the stack of scopes. Consolidated patch for both proofreadings will follow if when there's no futher discussion.