;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Christopher Baines ;;; Copyright © 2020 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu tests databases) #:use-module (gnu tests) #:use-module (gnu system) #:use-module (gnu system file-systems) #:use-module (gnu system shadow) #:use-module (gnu system vm) #:use-module (gnu services) #:use-module (gnu services databases) #:use-module (gnu services networking) #:use-module (gnu packages databas
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexlamsl <alexlamsl@gmail.com>2017-02-18 19:03:53 +0800
committeralexlamsl <alexlamsl@gmail.com>2017-02-21 13:29:57 +0800
commit148047fbbf1951a52e69170edf510c59b3899e6c (patch)
tree6650bc383c58f0e0629c43620b901aded8d0abbc /README.md
parentd11dca3cf9e34302ce12a6c9f1cd81b22551f2ba (diff)
downloadtracifyjs-148047fbbf1951a52e69170edf510c59b3899e6c.tar.gz
tracifyjs-148047fbbf1951a52e69170edf510c59b3899e6c.zip
drop unused: toplevel, assign-only
- assign statement does not count towards variable usage by default - only works with assignments on the same scope level as declaration - can be disabled with `unused` set to "keep_assign" - `toplevel` to drop unused top-level variables and/or functions - `top_retain` to whitelist top-level exceptions closes #1450
Diffstat (limited to 'README.md')
-rw-r--r--README.md10
1 files changed, 9 insertions, 1 deletions
diff --git a/README.md b/README.md
index a8b55843..a2eaeae4 100644
--- a/README.md
+++ b/README.md
@@ -361,7 +361,15 @@ to set `true`; it's effectively a shortcut for `foo=true`).
- `loops` -- optimizations for `do`, `while` and `for` loops when we can
statically determine the condition
-- `unused` -- drop unreferenced functions and variables
+- `unused` -- drop unreferenced functions and variables (simple direct variable
+ assignments do not count as references unless set to `"keep_assign"`)
+
+- `toplevel` -- drop unreferenced functions (`"funcs"`) and/or variables (`"vars"`)
+ in the toplevel scope (`false` by default, `true` to drop both unreferenced
+ functions and variables)
+
+- `top_retain` -- prevent specific toplevel functions and variables from `unused`
+ removal (can be array, comma-separated, RegExp or function. Implies `toplevel`)
- `hoist_funs` -- hoist function declarations
(with-imported-modules '((gnu build marionette)) #~(begin (use-modules (srfi srfi-11) (srfi srfi-64) (gnu build marionette)) (define marionette (make-marionette (list #$vm))) (mkdir #$output) (chdir #$output) (test-begin "mysql") (test-assert "service running" (marionette-eval '(begin (use-modules (gnu services herd)) (match (start-service 'mysql) (#f #f) (('service response-parts ...) (match (assq-ref response-parts 'running) ((pid) (number? pid)))))) marionette)) (test-assert "mysql_upgrade completed" (wait-for-file "/var/lib/mysql/mysql_upgrade_info" marionette)) (test-eq "create database" 0 (marionette-eval '(begin (system* #$(file-append mariadb "/bin/mysql") "-e" "CREATE DATABASE guix;")) marionette)) (test-eq "create table" 0 (marionette-eval '(begin (system* #$(file-append mariadb "/bin/mysql") "guix" "-e" "CREATE TABLE facts (id INT, data VARCHAR(12));")) marionette)) (test-eq "insert data" 0 (marionette-eval '(begin (system* #$(file-append mariadb "/bin/mysql") "guix" "-e" "INSERT INTO facts VALUES (1, 'awesome')")) marionette)) (test-equal "retrieve data" "awesome\n" (marionette-eval '(begin (use-modules (ice-9 popen)) (let* ((port (open-pipe* OPEN_READ #$(file-append mariadb "/bin/mysql") "guix" "-NB" "-e" "SELECT data FROM facts WHERE id=1;")) (output (get-string-all port))) (close-pipe port) output)) marionette)) (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0))))) (gexp->derivation "mysql-test" test)) (define %test-mysql (system-test (name "mysql") (description "Start the MySQL service.") (value (run-mysql-test))))