Beispiel #1
0
#!/usr/bin/env python3

import os
from utils import expect_success, expect_failure, fail, run_for, check_fixture

## spago init

expect_success(['spago', 'init'], "Spago should have set up a project")

expect_failure(
    ['spago', 'init'],
    "Spago should refuse to overwrite an existing project without -f")

# Here we check that spago does not overwrite any source files we might have
expect_success(['rm', 'spago.dhall', 'packages.dhall'],
               "Cleaning of config files should succeed")
with open('src/Main.purs', 'w') as f:
    f.write("Something")
expect_success(['spago', 'init'],
               "Spago should not overwrite files when initing a project")
with open('src/Main.purs', 'r') as f:
    assert f.read() == 'Something'
expect_success(['rm', 'src/Main.purs'], "")

expect_success(['spago', 'init', '-f'],
               "Spago should always succeed in doing init with force")

## spago install

# Run `install` once and kill it soon to simulate failure
run_for(0.5, ['spago', 'install', '-j', '3'])
Beispiel #2
0
#!/usr/bin/env python3

import os
import json
import time
from utils import expect_success, expect_failure, fail, run_for, check_fixture

## spago init

expect_success(['spago', 'init'], "Spago should have set up a project")

expect_failure(
    ['spago', 'init'],
    "Spago should refuse to overwrite an existing project without -f")

# Here we check that spago does not overwrite any source files we might have
expect_success(['rm', 'spago.dhall', 'packages.dhall'],
               "Cleaning of config files should succeed")
with open('src/Main.purs', 'w') as f:
    f.write("Something")
expect_success(['spago', 'init'],
               "Spago should not overwrite files when initing a project")
with open('src/Main.purs', 'r') as f:
    assert f.read() == 'Something'
expect_success(['rm', 'src/Main.purs'], "")
expect_success(['rmdir', 'src'], "")

expect_success(['spago', 'init', '-f'],
               "Spago should always succeed in doing init with force")

# Here we check that spago can import a project from psc-package
Beispiel #3
0
#!/usr/bin/env python3

import os
from utils import expect_success, expect_failure, fail

## spago psc-package-local-setup

expect_success(['spago', 'psc-package-local-setup'],
               "Local setup failed on first run.")

if not os.path.exists('packages.dhall'):
    fail("Failed to produce packages.dhall from local setup")

expect_failure([
    'spago', 'psc-package-local-setup'
], "Running local setup twice should have caused an error with an existing setup"
               )

## spago psc-package-insdhall

expect_success(['spago', 'psc-package-insdhall'],
               "Insdhall should have run successfully")

if not os.path.exists('.psc-package/local/.set/packages.json'):
    fail("Insdhallation failed to produce a package set")

expect_success(['psc-package', 'build'],
               "Psc-Package build should have worked successfully")

## spago psc-package clean