Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/regress/infra-unittests regress/infra-unittests: repla...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/01fa7794f69b
branches:  trunk
changeset: 431306:01fa7794f69b
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon May 11 20:22:31 2020 +0000

description:
regress/infra-unittests: replace double quotes with single quotes

Strings in single quotes are simpler to understand and also need fewer
pixels on the screen.

diffstat:

 regress/infra-unittests/subst.sh |  494 +++++++++++++++++++-------------------
 1 files changed, 247 insertions(+), 247 deletions(-)

diffs (truncated from 1401 to 300 lines):

diff -r 210d470e6f04 -r 01fa7794f69b regress/infra-unittests/subst.sh
--- a/regress/infra-unittests/subst.sh  Mon May 11 19:52:13 2020 +0000
+++ b/regress/infra-unittests/subst.sh  Mon May 11 20:22:31 2020 +0000
@@ -1,18 +1,18 @@
 #! /bin/sh
-# $NetBSD: subst.sh,v 1.36 2020/05/11 19:52:13 rillig Exp $
+# $NetBSD: subst.sh,v 1.37 2020/05/11 20:22:31 rillig Exp $
 #
 # Tests for mk/subst.mk.
 #
 
 set -eu
 
-. "./test.subr"
+. './test.subr'
 
 test_case_set_up() {
        wrkdir="$tmpdir/wrkdir"
        mkdir "$wrkdir"
 
-       create_file "prepare-subst.mk" <<-EOF
+       create_file 'prepare-subst.mk' <<-EOF
                # The tools that are used by subst.mk
                AWK=            awk
                CHMOD=          chmod
@@ -49,11 +49,11 @@
 }
 
 
-if test_case_begin "single file"; then
+if test_case_begin 'single file'; then
 
        # A single file is patched successfully.
 
-       create_file "subst-single.mk" <<-EOF
+       create_file 'subst-single.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      subst-single.txt
@@ -65,25 +65,25 @@
                all: subst-class
        EOF
 
-       create_file_lines "subst-single.txt" \
-               "before"
+       create_file_lines 'subst-single.txt' \
+               'before'
 
-       run_bmake "subst-single.mk" > "$tmpdir/output"
+       run_bmake 'subst-single.mk' > "$tmpdir/output"
 
        assert_that "$tmpdir/output" --file-contains-exactly \
                "=> Substituting \"class\" in subst-single.txt"
-       assert_that "subst-single.txt" --file-contains-exactly \
-               "after"
+       assert_that 'subst-single.txt' --file-contains-exactly \
+               'after'
 
        test_case_end
 fi
 
 
-if test_case_begin "several individual files"; then
+if test_case_begin 'several individual files'; then
 
        # Several individual files are patched successfully.
 
-       create_file "testcase.mk" <<-EOF
+       create_file 'testcase.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      first second third
@@ -95,28 +95,28 @@
                all: subst-class
        EOF
 
-       create_file_lines "first"       "the first file"
-       create_file_lines "second"      "the second file"
-       create_file_lines "third"       "the third file"
+       create_file_lines 'first'       'the first file'
+       create_file_lines 'second'      'the second file'
+       create_file_lines 'third'       'the third file'
 
-       run_bmake "testcase.mk" > "$tmpdir/output"
+       run_bmake 'testcase.mk' > "$tmpdir/output"
 
        assert_that "$tmpdir/output" --file-is-lines \
                "=> Substituting \"class\" in first second third"
-       assert_that "first" --file-contains-exactly "the first example"
-       assert_that "second" --file-contains-exactly "the second example"
-       assert_that "third" --file-contains-exactly "the third example"
+       assert_that 'first' --file-contains-exactly 'the first example'
+       assert_that 'second' --file-contains-exactly 'the second example'
+       assert_that 'third' --file-contains-exactly 'the third example'
 
        test_case_end
 fi
 
 
-if test_case_begin "several files by pattern"; then
+if test_case_begin 'several files by pattern'; then
 
        # Several files are patched successfully.
        # The filenames are given by a pattern.
 
-       create_file "testcase.mk" <<-EOF
+       create_file 'testcase.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      pattern-*
@@ -128,22 +128,22 @@
                all: subst-class
        EOF
 
-       create_file_lines "pattern-first"       "the first file"
-       create_file_lines "pattern-second"      "the second file"
-       create_file_lines "pattern-third"       "the third file"
+       create_file_lines 'pattern-first'       'the first file'
+       create_file_lines 'pattern-second'      'the second file'
+       create_file_lines 'pattern-third'       'the third file'
 
-       output=$(run_bmake "testcase.mk")
+       output=$(run_bmake 'testcase.mk')
 
        assert_that "$output" --equals "=> Substituting \"class\" in pattern-*"
-       assert_that "pattern-first" --file-contains-exactly "the first example"
-       assert_that "pattern-second" --file-contains-exactly "the second example"
-       assert_that "pattern-third" --file-contains-exactly "the third example"
+       assert_that 'pattern-first' --file-contains-exactly 'the first example'
+       assert_that 'pattern-second' --file-contains-exactly 'the second example'
+       assert_that 'pattern-third' --file-contains-exactly 'the third example'
 
        test_case_end
 fi
 
 
-if test_case_begin "pattern with 1 noop"; then
+if test_case_begin 'pattern with 1 noop'; then
 
        # Several files are given via a pattern.
        # Most of the files are patched, but one stays the same.
@@ -152,7 +152,7 @@
        # only an info is logged.
        # This is not an error.
 
-       create_file "testcase.mk" <<-EOF
+       create_file 'testcase.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      pattern-*
@@ -164,19 +164,19 @@
                all: subst-class
        EOF
 
-       create_file_lines "pattern-first"       "the first file"
-       create_file_lines "pattern-second"      "the second is already an example"
-       create_file_lines "pattern-third"       "the third file"
+       create_file_lines 'pattern-first'       'the first file'
+       create_file_lines 'pattern-second'      'the second is already an example'
+       create_file_lines 'pattern-third'       'the third file'
 
-       run_bmake "testcase.mk" > "$tmpdir/output"
-       create_file_lines "expected-output" \
+       run_bmake 'testcase.mk' > "$tmpdir/output"
+       create_file_lines 'expected-output' \
                '=> Substituting "class" in pattern-*' \
                'info: [subst.mk:class] Nothing changed in "pattern-second".'
 
        assert_that "$tmpdir/output" --file-equals "expected-output"
-       assert_that "pattern-first" --file-contains-exactly "the first example"
-       assert_that "pattern-second" --file-contains-exactly "the second is already an example"
-       assert_that "pattern-third" --file-contains-exactly "the third example"
+       assert_that 'pattern-first' --file-contains-exactly 'the first example'
+       assert_that 'pattern-second' --file-contains-exactly 'the second is already an example'
+       assert_that 'pattern-third' --file-contains-exactly 'the third example'
 
        test_case_end
 fi
@@ -184,7 +184,7 @@
 
 if test_case_begin "single file noop, noop_ok=yes"; then
 
-       create_file "testcase.mk" <<-EOF
+       create_file 'testcase.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      single
@@ -197,15 +197,15 @@
                all: subst-class
        EOF
 
-       create_file_lines "single"      "already an example"
+       create_file_lines 'single'      'already an example'
 
-       run_bmake "testcase.mk" > "$tmpdir/output" \
+       run_bmake 'testcase.mk' > "$tmpdir/output" \
        && exitcode=0 || exitcode=$?
 
        assert_that "$tmpdir/output" --file-is-lines \
                '=> Substituting "class" in single' \
                'info: [subst.mk:class] Nothing changed in "single".'
-       assert_that "single" --file-contains-exactly "already an example"
+       assert_that 'single' --file-contains-exactly 'already an example'
        assert_that "$exitcode" --equals "0"
 
        test_case_end
@@ -214,7 +214,7 @@
 
 if test_case_begin "single file noop, noop_ok=no"; then
 
-       create_file "testcase.mk" <<-EOF
+       create_file 'testcase.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      single
@@ -227,12 +227,12 @@
                all: subst-class
        EOF
 
-       create_file_lines "single"      "already an example"
+       create_file_lines 'single'      'already an example'
 
-       run_bmake "testcase.mk" > "$tmpdir/output" \
+       run_bmake 'testcase.mk' > "$tmpdir/output" \
        && exitcode=0 || exitcode=$?
 
-       create_file_lines "expected-output" \
+       create_file_lines 'expected-output' \
                '=> Substituting "class" in single' \
                'warning: [subst.mk:class] Nothing changed in "single".' \
                'fail: [subst.mk:class] The filename pattern "single" has no effect.' \
@@ -240,17 +240,17 @@
                '' \
                'Stop.' \
                "$make: stopped in $PWD"
-       assert_that "$tmpdir/output" --file-equals "expected-output"
-       assert_that "single" --file-contains-exactly "already an example"
+       assert_that "$tmpdir/output" --file-equals 'expected-output'
+       assert_that 'single' --file-contains-exactly 'already an example'
        assert_that "$exitcode" --equals "1"
 
        test_case_end
 fi
 
 
-if test_case_begin "single file nonexistent"; then
+if test_case_begin 'single file nonexistent'; then
 
-       create_file "testcase.mk" <<-EOF
+       create_file 'testcase.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      nonexistent
@@ -263,7 +263,7 @@
                all: subst-class
        EOF
 
-       run_bmake "testcase.mk" > "$tmpdir/output" \
+       run_bmake 'testcase.mk' > "$tmpdir/output" \
        && exitcode=0 || exitcode=$?
 
        assert_that "$tmpdir/output" --file-is-lines \
@@ -280,9 +280,9 @@
 fi
 
 
-if test_case_begin "single file nonexistent ok"; then
+if test_case_begin 'single file nonexistent ok'; then
 
-       create_file "testcase.mk" <<-EOF
+       create_file 'testcase.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      nonexistent
@@ -295,7 +295,7 @@
                all: subst-class
        EOF
 
-       run_bmake "testcase.mk" > "$tmpdir/output" \
+       run_bmake 'testcase.mk' > "$tmpdir/output" \
        && exitcode=0 || exitcode=$?
 
        assert_that "$tmpdir/output" --file-is-lines \
@@ -309,7 +309,7 @@
 
 if test_case_begin "several patterns, 1 nonexistent"; then
 
-       create_file "testcase.mk" <<-EOF
+       create_file 'testcase.mk' <<-EOF
                SUBST_CLASSES+=         class
                SUBST_STAGE.class=      pre-configure
                SUBST_FILES.class=      *exist* *not-found*
@@ -321,16 +321,16 @@
                all: subst-class
        EOF
 
-       create_file_lines "exists"      "this file exists"
+       create_file_lines 'exists'      'this file exists'
 
-       run_bmake "testcase.mk" > "$tmpdir/output" \



Home | Main Index | Thread Index | Old Index