From c181ab9de94337cb4dfa5df2f9a8a609b4531036 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sun, 31 Oct 2021 22:22:52 +1000 Subject: [PATCH] Coding style. - Remove all dead code from tests. --- tests/golden-files/input/hi3.cpython-34.pyc | Bin 208 -> 0 bytes tests/golden-files/input/perl6.p6 | 232 ------------------ tests/golden-files/input/perl6.pl | 232 ------------------ .../results/perl6_syntax-perl6_p6 | 16 -- .../golden-files/results/perl_syntax-perl6_pl | 16 -- .../results/pydisasm-hi3_cpython-34_pyc | 48 ---- tests/lscolors_test.py | 7 - tests/tools_test.py | 24 +- 8 files changed, 1 insertion(+), 574 deletions(-) delete mode 100644 tests/golden-files/input/hi3.cpython-34.pyc delete mode 100644 tests/golden-files/input/perl6.p6 delete mode 100644 tests/golden-files/input/perl6.pl delete mode 100644 tests/golden-files/results/perl6_syntax-perl6_p6 delete mode 100644 tests/golden-files/results/perl_syntax-perl6_pl delete mode 100644 tests/golden-files/results/pydisasm-hi3_cpython-34_pyc diff --git a/tests/golden-files/input/hi3.cpython-34.pyc b/tests/golden-files/input/hi3.cpython-34.pyc deleted file mode 100644 index ee2fac47c6ceff24c13d0d26b23bbefe3560a0fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 208 zcmaFI!^<^;c}tiK0|UcjAcg}bAj<)Wiv@s03J@_ev@kG40U1mT!J5p;Kv6gVsdWb8 zVm=^I0#@71$iN8H6|BkRcZ(?_QF!75|Pd_uSptM9kBhy%~ rpt6V&CPO2SP7f2HTAyyxX diff --git a/tests/golden-files/input/perl6.p6 b/tests/golden-files/input/perl6.p6 deleted file mode 100644 index 65073eb..0000000 --- a/tests/golden-files/input/perl6.p6 +++ /dev/null @@ -1,232 +0,0 @@ -#!/usr/bin/env perl6 - -use v6; - -my $string = 'I look like a # comment!'; - -if $string eq 'foo' { - say 'hello'; -} - -regex http-verb { - 'GET' - | 'POST' - | 'PUT' - | 'DELETE' - | 'TRACE' - | 'OPTIONS' - | 'HEAD' -} - -# a sample comment - -say 'Hello from Perl 6!' - - -#`{ -multi-line comment! -} - -say 'here'; - -#`( -multi-line comment! -) - -say 'here'; - -#`{{{ -I'm a special comment! -}}} - -say 'there'; - -#`{{ -I'm { even } specialer! -}} - -say 'there'; - -#`{{ -does {{nesting}} work? -}} - -#`«< -trying mixed delimiters -» - -my $string = qq; -my $string = qq«Hooray, arbitrary delimiter!»; -my $string = q ; -my $string = qq<>; - -my %hash := Hash.new; - -=begin pod - -Here's some POD! Wooo - -=end pod - -=for Testing - This is POD (see? role isn't highlighted) - -say('this is not!'); - -say 'Moar code!'; - -my $don't = 16; - -sub don't($x) { - !$x -} - -say don't 'foo'; - -my %hash = ( - :foo(1), -); - -say %hash; -say %hash<>; -say %hash«foo»; - -say %*hash; -say %*hash<>; -say %*hash«foo»; - -say $; -say $; - -for (@A Z @B) -> $a, $b { - say $a + $b; -} - -Q:PIR { - .loadlib "somelib" -} - -my $longstring = q/ - lots - of - text -/; - -my $heredoc = q:to/END_SQL/; -SELECT * FROM Users -WHERE first_name = 'Rob' -END_SQL -my $hello; - -# Fun with regexen - -if 'food' ~~ /foo/ { - say 'match!' -} - -my $re = /foo/; -my $re2 = m/ foo /; -my $re3 = m:i/ FOO /; - -call-a-sub(/ foo /); -call-a-sub(/ foo \/ bar /); - -my $re4 = rx/something | something-else/; -my $result = ms/regexy stuff/; -my $sub0 = s/regexy stuff/more stuff/; -my $sub = ss/regexy stuff/more stuff/; -my $trans = tr/regexy stuff/more stuff/; - -my @values = ; -call-sub(); -call-sub ; - -my $result = $a < $b; - -for -> $letter { - say $letter; -} - -sub test-sub { - say @_; - say $!; - say $/; - say $0; - say $1; - say @*ARGS; - say $*ARGFILES; - say &?BLOCK; - say ::?CLASS; - say $?CLASS; - say @=COMMENT; - say %?CONFIG; - say $*CWD; - say $=data; - say %?DEEPMAGIC; - say $?DISTRO; - say $*DISTRO; - say $*EGID; - say %*ENV; - say $*ERR; - say $*EUID; - say $*EXECUTABLE_NAME; - say $?FILE; - say $?GRAMMAR; - say $*GID; - say $*IN; - say @*INC; - say %?LANG; - say $*LANG; - say $?LINE; - say %*META-ARGS; - say $?MODULE; - say %*OPTS; - say %*OPT; - say $?KERNEL; - say $*KERNEL; - say $*OUT; - say $?PACKAGE; - say $?PERL; - say $*PERL; - say $*PID; - say %=pod; - say $*PROGRAM_NAME; - say %*PROTOCOLS; - say ::?ROLE; - say $?ROLE; - say &?ROUTINE; - say $?SCOPE; - say $*TZ; - say $*UID; - say $?USAGE; - say $?VM; - say $?XVM; -} - -say ; - -my $perl5_re = m:P5/ fo{2} /; -my $re5 = rx«something | something-else»; - -my $M := %*COMPILING<%?OPTIONS>; - -say $M; - -sub regex-name { ... } -my $pair = role-name => 'foo'; -$pair = rolesque => 'foo'; - -my sub something(Str:D $value) { ... } - -my $s = q«< -some -string -stuff -»; - -my $regex = m«< some chars »; -# after - -say $/; - -roleq; diff --git a/tests/golden-files/input/perl6.pl b/tests/golden-files/input/perl6.pl deleted file mode 100644 index 65073eb..0000000 --- a/tests/golden-files/input/perl6.pl +++ /dev/null @@ -1,232 +0,0 @@ -#!/usr/bin/env perl6 - -use v6; - -my $string = 'I look like a # comment!'; - -if $string eq 'foo' { - say 'hello'; -} - -regex http-verb { - 'GET' - | 'POST' - | 'PUT' - | 'DELETE' - | 'TRACE' - | 'OPTIONS' - | 'HEAD' -} - -# a sample comment - -say 'Hello from Perl 6!' - - -#`{ -multi-line comment! -} - -say 'here'; - -#`( -multi-line comment! -) - -say 'here'; - -#`{{{ -I'm a special comment! -}}} - -say 'there'; - -#`{{ -I'm { even } specialer! -}} - -say 'there'; - -#`{{ -does {{nesting}} work? -}} - -#`«< -trying mixed delimiters -» - -my $string = qq; -my $string = qq«Hooray, arbitrary delimiter!»; -my $string = q ; -my $string = qq<>; - -my %hash := Hash.new; - -=begin pod - -Here's some POD! Wooo - -=end pod - -=for Testing - This is POD (see? role isn't highlighted) - -say('this is not!'); - -say 'Moar code!'; - -my $don't = 16; - -sub don't($x) { - !$x -} - -say don't 'foo'; - -my %hash = ( - :foo(1), -); - -say %hash; -say %hash<>; -say %hash«foo»; - -say %*hash; -say %*hash<>; -say %*hash«foo»; - -say $; -say $; - -for (@A Z @B) -> $a, $b { - say $a + $b; -} - -Q:PIR { - .loadlib "somelib" -} - -my $longstring = q/ - lots - of - text -/; - -my $heredoc = q:to/END_SQL/; -SELECT * FROM Users -WHERE first_name = 'Rob' -END_SQL -my $hello; - -# Fun with regexen - -if 'food' ~~ /foo/ { - say 'match!' -} - -my $re = /foo/; -my $re2 = m/ foo /; -my $re3 = m:i/ FOO /; - -call-a-sub(/ foo /); -call-a-sub(/ foo \/ bar /); - -my $re4 = rx/something | something-else/; -my $result = ms/regexy stuff/; -my $sub0 = s/regexy stuff/more stuff/; -my $sub = ss/regexy stuff/more stuff/; -my $trans = tr/regexy stuff/more stuff/; - -my @values = ; -call-sub(); -call-sub ; - -my $result = $a < $b; - -for -> $letter { - say $letter; -} - -sub test-sub { - say @_; - say $!; - say $/; - say $0; - say $1; - say @*ARGS; - say $*ARGFILES; - say &?BLOCK; - say ::?CLASS; - say $?CLASS; - say @=COMMENT; - say %?CONFIG; - say $*CWD; - say $=data; - say %?DEEPMAGIC; - say $?DISTRO; - say $*DISTRO; - say $*EGID; - say %*ENV; - say $*ERR; - say $*EUID; - say $*EXECUTABLE_NAME; - say $?FILE; - say $?GRAMMAR; - say $*GID; - say $*IN; - say @*INC; - say %?LANG; - say $*LANG; - say $?LINE; - say %*META-ARGS; - say $?MODULE; - say %*OPTS; - say %*OPT; - say $?KERNEL; - say $*KERNEL; - say $*OUT; - say $?PACKAGE; - say $?PERL; - say $*PERL; - say $*PID; - say %=pod; - say $*PROGRAM_NAME; - say %*PROTOCOLS; - say ::?ROLE; - say $?ROLE; - say &?ROUTINE; - say $?SCOPE; - say $*TZ; - say $*UID; - say $?USAGE; - say $?VM; - say $?XVM; -} - -say ; - -my $perl5_re = m:P5/ fo{2} /; -my $re5 = rx«something | something-else»; - -my $M := %*COMPILING<%?OPTIONS>; - -say $M; - -sub regex-name { ... } -my $pair = role-name => 'foo'; -$pair = rolesque => 'foo'; - -my sub something(Str:D $value) { ... } - -my $s = q«< -some -string -stuff -»; - -my $regex = m«< some chars »; -# after - -say $/; - -roleq; diff --git a/tests/golden-files/results/perl6_syntax-perl6_p6 b/tests/golden-files/results/perl6_syntax-perl6_p6 deleted file mode 100644 index 654308d..0000000 --- a/tests/golden-files/results/perl6_syntax-perl6_p6 +++ /dev/null @@ -1,16 +0,0 @@ -#[31m===#[0mSORRY!#[31m===#[0m -Two terms in a row across lines (missing semicolon or comma?) -at /tmp/eris/golden-files/./input/perl6.p6:30 -------> #[32msay 'Hello from Perl 6!'#[33m⏏#[31m#[0m - expecting any of: - infix - infix stopper - postfix - statement end - statement modifier - statement modifier loop -Other potential difficulties: - Useless declaration of a has-scoped method in mainline (did you mean 'my regex http-verb'?) - at /tmp/eris/golden-files/./input/perl6.p6:11 - ------> #[32mregex #[33m⏏#[31mhttp-verb {#[0m - \ No newline at end of file diff --git a/tests/golden-files/results/perl_syntax-perl6_pl b/tests/golden-files/results/perl_syntax-perl6_pl deleted file mode 100644 index 42475a8..0000000 --- a/tests/golden-files/results/perl_syntax-perl6_pl +++ /dev/null @@ -1,16 +0,0 @@ -#[31m===#[0mSORRY!#[31m===#[0m -Two terms in a row across lines (missing semicolon or comma?) -at /tmp/eris/golden-files/./input/perl6.pl:30 -------> #[32msay 'Hello from Perl 6!'#[33m⏏#[31m#[0m - expecting any of: - infix - infix stopper - postfix - statement end - statement modifier - statement modifier loop -Other potential difficulties: - Useless declaration of a has-scoped method in mainline (did you mean 'my regex http-verb'?) - at /tmp/eris/golden-files/./input/perl6.pl:11 - ------> #[32mregex #[33m⏏#[31mhttp-verb {#[0m - \ No newline at end of file diff --git a/tests/golden-files/results/pydisasm-hi3_cpython-34_pyc b/tests/golden-files/results/pydisasm-hi3_cpython-34_pyc deleted file mode 100644 index 4845665..0000000 --- a/tests/golden-files/results/pydisasm-hi3_cpython-34_pyc +++ /dev/null @@ -1,48 +0,0 @@ -# pydisasm version 3.5.0 -# Python bytecode 3.4 (3310) -# Disassembled from Python 3.5.3 (default, Jan 19 2017, 14:11:04) -# [GCC 6.3.0 20170118] -# Timestamp in code: 1454637976 (2016-02-05 02:06:16) -# Source code size mod 2**32: 28 bytes -# Method Name: -# Filename: ./input/hi3.py -# Argument count: 0 -# Kw-only arguments: 0 -# Number of locals: 0 -# Stack size: 2 -# Flags: 0x00000040 (NOFREE) -# First Line: 3 -# Constants: -# 0: -# 1: 'hi' -# 2: None -# Names: -# 0: hi - 3: 0 LOAD_CONST 0 () - 3 LOAD_CONST 1 ('hi') - 6 MAKE_FUNCTION 0 (0 positional, 0 name and default, 0 annotations) - 9 STORE_NAME 0 (hi) - 12 LOAD_CONST 2 (None) - 15 RETURN_VALUE - - -# Method Name: hi -# Filename: ./input/hi3.py -# Argument count: 0 -# Kw-only arguments: 0 -# Number of locals: 0 -# Stack size: 2 -# Flags: 0x00000043 (NOFREE | NEWLOCALS | OPTIMIZED) -# First Line: 3 -# Constants: -# 0: None -# 1: 'hi' -# Names: -# 0: print - 4: 0 LOAD_GLOBAL 0 (print) - 3 LOAD_CONST 1 ('hi') - 6 CALL_FUNCTION 1 (1 positional, 0 keyword pair) - 9 POP_TOP - 10 LOAD_CONST 0 (None) - 13 RETURN_VALUE - \ No newline at end of file diff --git a/tests/lscolors_test.py b/tests/lscolors_test.py index 52c8801..5b26ecc 100755 --- a/tests/lscolors_test.py +++ b/tests/lscolors_test.py @@ -144,13 +144,6 @@ class ColorKeyForFileTestCase(TempDirTestCase): self.COLOR_CODES), lscolors.CHARACTER_DEVICE_KEY) - # FIX: Need a block device that is inside containers. - # def test_color_code_for_block_device(self): - # block_device_path = "/dev/loop0" - # self.assertEqual( - # lscolors.color_key_for_path(block_device_path, self.COLOR_CODES), - # lscolors.BLOCK_DEVICE_KEY) - def test_color_code_for_sticky_directory(self): mode = os.stat(self.temp_dir).st_mode os.chmod(self.temp_dir, mode | stat.S_ISVTX) diff --git a/tests/tools_test.py b/tests/tools_test.py index 2c9c8fd..714b272 100755 --- a/tests/tools_test.py +++ b/tests/tools_test.py @@ -86,14 +86,6 @@ class ToolsTestCase(unittest.TestCase): def test_python_syntax(self): self._test_tool(tools.python_syntax, self.HI_OK) - # FIX: python_unittests has a time duration in its output. - # def test_python_unittests(self): - # self._test_tool(tools.python_unittests, - # [("hi3.py", tools.Status.not_applicable), - # ("hi.py", tools.Status.not_applicable), - # ("hi3_test.py", tools.Status.ok), - # ("test_foo.py", tools.Status.ok)]) - HI_OK = [("hi3.py", tools.Status.ok)] def test_pydoc(self): @@ -122,23 +114,9 @@ class ToolsTestCase(unittest.TestCase): def test_python_mccabe(self): self._test_tool(tools.python_mccabe, self.HI_OK) - # FIX: Make the golden-file deterministic - # def test_pydisasm(self): - # self._test_tool(tools.pydisasm, - # [("hi3.cpython-34.pyc", tools.Status.ok)]) - def test_perl_syntax(self): self._test_tool(tools.perl_syntax, - [("perl.pl", tools.Status.ok), - # ("perl6.pl", tools.Status.problem) - ]) - - # def test_perltidy(self): - # self._test_tool(tools.perltidy, [("perl.pl", tools.Status.ok)]) - - # def test_perl6_syntax(self): - # self._test_tool(tools.perl6_syntax, - # [("perl6.p6", tools.Status.problem)]) + [("perl.pl", tools.Status.ok)]) def test_c_syntax_gcc(self): self._test_tool(tools.c_syntax_gcc, [("hello.c", tools.Status.ok)])