aboutsummaryrefslogtreecommitdiff
multiple_functions: {
    options = {
        hoist_funs: false,
        if_return: true,
    }
    input: {
        ( function() {
            if ( !window ) {
                return;
            }
            function f() {}
            function g() {}
        } )();
    }
    expect: {
        ( function() {
            // NOTE: other compression steps will reduce this
            // down to just `window`.
            if ( !window );
            function f() {}
            function g() {}
        } )();
    }
}

single_function: {
    options = {
        hoist_funs: false,
        if_return: true,
    }
    input: {
        ( function() {
            if ( !window ) {
                return;
            }
            function f() {}
        } )();
    }
    expect: {
        ( function() {
            if ( !window );
            function f() {}
        } )();
    }
}

deeply_nested: {
    options = {
        hoist_funs: false,
        if_return: true,
    }
    input: {
        ( function() {
            if ( !window ) {
                return;
            }
            function f() {}
            function g() {}
            if ( !document ) {
                return;
            }
            function h() {}
        } )();
    }
    expect: {
        ( function() {
            // NOTE: other compression steps will reduce this
            // down to just `window`.
            if ( window )
                if ( !document );
            function f() {}
            function g() {}
            function h() {}
        } )();
    }
}

not_hoisted_when_already_nested: {
    options = {
        hoist_funs: false,
        if_return: true,
    }
    input: {
        ( function() {
            if ( !window ) {
                return;
            }
            if ( foo ) function f() {}
        } )();
    }
    expect: {
        ( function() {
            if ( window )
                if ( foo ) function f() {}
        } )();
    }
}

defun_if_return: {
    options = {
        hoist_funs: false,
        if_return: true,
    }
    input: {
        function e() {
            function f() {}
            if (!window) return;
            else function g() {}
            function h() {}
        }
    }
    expect: {
        function e() {
            function f() {}
            if (window) function g() {}
            function h() {}
        }
    }
}

defun_hoist_funs: {
    options = {
        hoist_funs: true,
        if_return: true,
    }
    input: {
        function e() {
            function f() {}
            if (!window) return;
            else function g() {}
            function h() {}
        }
    }
    expect: {
        function e() {
            function f() {}
            function g() {}
            function h() {}
            if (window);
        }
    }
}

defun_else_if_return: {
    options = {
        hoist_funs: false,
        if_return: true,
    }
    input: {
        function e() {
            function f() {}
            if (window) function g() {}
            else return;
            function h() {}
        }
    }
    expect: {
        function e() {
            function f() {}
            if (window) function g() {}
            function h() {}
        }
    }
}
n-mcron-test, run-nss-mdns-test): Use 'test-assert' with the return value of 'start-service'. * gnu/tests/admin.scm (run-tailon-test): Idem. * gnu/tests/dict.scm (run-dicod-test): Idem. * gnu/tests/mail.scm (run-opensmtpd-test, run-exim-test, run-dovecot-test): Idem. * gnu/tests/messaging.scm (run-xmpp-test, run-bitlbee-test): Idem. * gnu/tests/nfs.scm (run-nfs-test): Idem. * gnu/tests/rsync.scm (run-rsync-test): Idem. * gnu/tests/ssh.scm (run-ssh-test): Idem. * gnu/tests/version-control.scm (run-cgit-test, run-git-http-test): Idem. * gnu/tests/web.scm (run-php-fpm-test): Idem. Clément Lassieur 2018-06-01tests: ssh: Use 'with-extensions'....* gnu/tests/ssh.scm (run-ssh-test)[test]: Wrap body in 'with-extensions'. Remove %load-path manipulation code. Ludovic Courtès 2017-11-01tests: ssh: Make sure we can run executables from PATH....* gnu/tests/ssh.scm (run-ssh-test): Add tests for running commands in system and user profile. Marius Bakke 2017-07-23Merge branch 'master' into core-updatesLeo Famulari 2017-07-20tests: Use 'virtual-machine' records instead of monadic procedures....* gnu/tests/base.scm (%test-basic-os): Use 'let*' instead of 'mlet*' and 'virtual-machine' instead of 'system-qemu-image/shared-store-script'. (run-mcron-test): Likewise. (run-nss-mdns-test): Likewise. * gnu/tests/dict.scm (run-dicod-test): Likewise. * gnu/tests/mail.scm (run-opensmtpd-test): Likewise. (run-exim-test): Likewise. * gnu/tests/messaging.scm (run-xmpp-test): Likewise. * gnu/tests/networking.scm (run-inetd-test): Likewise. * gnu/tests/nfs.scm (run-nfs-test): Likewise. * gnu/tests/ssh.scm (run-ssh-test): Likewise. * gnu/tests/web.scm (run-nginx-test): Likewise. Ludovic Courtès 2017-07-18tests: ssh: Use 'guile-ssh'....* gnu/tests/ssh.scm (run-ssh-test): Use GUILE-SSH instead of GUILE2.0-SSH. Ludovic Courtès 2017-06-12marionette: Factorize 'wait-for-file'....* gnu/build/marionette.scm (wait-for-file): New procedure. * gnu/tests/base.scm (run-mcron-test)[test](wait-for-file): Remove. Pass second argument in 'wait-for-file' calls. * gnu/tests/ssh.scm (run-ssh-test)[test](wait-for-file): Remove. Pass second argument in 'wait-for-file' calls. * gnu/tests/messaging.scm (run-xmpp-test)[test](guest-wait-for-file): Remove. Use 'wait-for-file' instead, with second argument. Ludovic Courtès 2017-05-21tests: ssh: Use 'guile2.0-ssh'....Fixes a regression introduced in 4d8806c3d662c74e6d48d0f0d6ce423fce9a3a08. * gnu/tests/ssh.scm (run-ssh-test): Use GUILE2.0-SSH instead of GUILE-SSH. Ludovic Courtès 2017-04-01tests: Introduce 'simple-operating-system' and use it....* gnu/tests.scm (%simple-os): New macro. (simple-operating-system): New macro. * gnu/tests/base.scm (%simple-os): Define using 'simple-operating-system'. (%mcron-os): Use 'simple-operating-system'. * gnu/tests/mail.scm (%opensmtpd-os): Likewise. * gnu/tests/messaging.scm (%base-os, os-with-service): Remove. (run-xmpp-test): Use 'simple-operating-system'. * gnu/tests/networking.scm (%inetd-os): Likewise. * gnu/tests/ssh.scm (%base-os, os-with-service): Remove. (run-ssh-test): Use 'simple-operating-system'. * gnu/tests/web.scm (%nginx-os): Likewise. Ludovic Courtès 2017-03-21tests: ssh: Add a test for SFTP....* gnu/tests/ssh.scm (run-ssh-test): Introduce "SFTP file writing and reading". Make 'sftp?' a keyword parameter. (%test-openssh): Pass #:sftp? #t to 'run-ssh-test'. Clément Lassieur 2017-03-21tests: ssh: Abstract session connection and authentication....* gnu/tests/ssh.scm (run-ssh-test): Introduce make-session-for-test, call-with-connected-session and call-with-connected-session/auth. (run-ssh-test)["connect"]: Rename to "shell command". Abstract its session connection and authentication work into the above three functions. Clément Lassieur