aboutsummaryrefslogtreecommitdiff
/**
 * There was an incorrect sort behaviour documented in issue #143:
 * (x = f(…)) <= x → x >= (x = f(…))
 *
 * For example, let the equation be:
 * (a = parseInt('100')) <= a
 *
 * If a was an integer and has the value of 99,
 * (a = parseInt('100')) <= a → 100 <= 100 → true
 *
 * When transformed incorrectly:
 * a >= (a = parseInt('100')) → 99 >= 100 → false
 */

tranformation_sort_order_equal: {
    options = {
        comparisons: true,
    }

    input: { (a = parseInt('100')) == a }
    expect: { (a = parseInt('100')) == a }
}

tranformation_sort_order_unequal: {
    options = {
        comparisons: true,
    }

    input: { (a = parseInt('100')) != a }
    expect: { (a = parseInt('100')) != a }
}

tranformation_sort_order_lesser_or_equal: {
    options = {
        comparisons: true,
    }

    input: { (a = parseInt('100')) <= a }
    expect: { (a = parseInt('100')) <= a }
}
tranformation_sort_order_greater_or_equal: {
    options = {
        comparisons: true,
    }

    input: { (a = parseInt('100')) >= a }
    expect: { (a = parseInt('100')) >= a }
}
(package "foo") (version "1") (urls '("ftp://example.org/foo-1.tar.gz")) (signature-urls '("ftp://example.org/foo-1.tar.gz.sig"))) (upstream-source (package "foo") (version "1") (urls '("ftp://example.org/foo-1.tar.xz")) (signature-urls '("ftp://example.org/foo-1.tar.xz.sig"))))))) (test-equal "preferred-upstream-source" '(("http://example.org/foo-2.0.tar.xz") ("http://example.org/foo-2.0.tar.xz.sig")) (let* ((package (dummy-package "foo" (version "1.0") (source (dummy-origin (uri "http://example.org/foo-1.0.tar.xz"))))) (source (upstream-source (package "foo") (version "2.0") (urls '("http://example.org/foo-2.0.tar.gz" "http://example.org/foo-2.0.tar.xz")) (signature-urls (map (cut string-append <> ".sig") urls)))) (preferred (preferred-upstream-source source package))) (list (upstream-source-urls preferred) (upstream-source-signature-urls preferred)))) (test-end)