# Path: rock/utils.py
# def isexecutable(path):
#     def isstr(s):
#     def isstr(s):
# def raw(text):
#     def __init__(self):
#     def __enter__(self):
#     def __exit__(self, type, value, traceback):
#     def run(self):
#     def write(self, text):
# class Shell(object):
# 
# Path: rock/exceptions.py
# class ConfigError(Error):
#     pass


import helper
from rock import utils
from rock.exceptions import ConfigError
    def test_arg(self):
        self.p.run('clean', ['--six', '--zero', 'one', '--two=2', 'three', 'four', '--five=five', '--six'])
        data = {}
        for value in self.split[0].split('\n'):
            if not value.startswith('export '):
                continue
            name = value.split(' ', 1)[1]
            if '=' not in name:
                continue
            data[name.split('=', 1)[0]] = value
        self.assertEqual(data.get('ROCK_ENV'), 'export ROCK_ENV="local"')
        self.assertEqual(data.get('ROCK_ARGV'), "export ROCK_ARGV='--six --zero one --two=2 three four --five=five --six'")
        self.assertEqual(data.get('ROCK_ARGS'), "export ROCK_ARGS='one three four'")
        self.assertEqual(data.get('ROCK_ARG0'), "export ROCK_ARG0=clean")
        self.assertEqual(data.get('ROCK_OPTS'), "export ROCK_OPTS='ZERO TWO FIVE SIX'")

    def test_run(self):
        self.p.run('run')
        self.assertEqual(self.script, 'echo zero')

    def test_run_manual(self):
        self.p.run('run', ['echo', 'hello'])
        self.assertEqual(self.script, 'echo hello')

    def test_run_no_section(self):
        self.p = helper.project(helper.Args(name='parent'))
        self.assertRaises(ConfigError, self.p.run, 'run')

    def test_run_section_not_string(self):
        self.p = helper.project(helper.Args(name='parent'))

# Path: rock/utils.py
# def isexecutable(path):
#     def isstr(s):
#     def isstr(s):
# def raw(text):
#     def __init__(self):
#     def __enter__(self):
#     def __exit__(self, type, value, traceback):
#     def run(self):
#     def write(self, text):
# class Shell(object):
# 
# Path: rock/exceptions.py
# class ConfigError(Error):
#     pass


# Path: tests/test_project.py
import helper
from rock import utils
from rock.exceptions import ConfigError

    def test_arg(self):
        self.p.run('clean', ['--six', '--zero', 'one', '--two=2', 'three', 'four', '--five=five', '--six'])
        data = {}
        for value in self.split[0].split('\n'):
            if not value.startswith('export '):
                continue
            name = value.split(' ', 1)[1]
            if '=' not in name:
                continue
            data[name.split('=', 1)[0]] = value
        self.assertEqual(data.get('ROCK_ENV'), 'export ROCK_ENV="local"')
        self.assertEqual(data.get('ROCK_ARGV'), "export ROCK_ARGV='--six --zero one --two=2 three four --five=five --six'")
        self.assertEqual(data.get('ROCK_ARGS'), "export ROCK_ARGS='one three four'")
        self.assertEqual(data.get('ROCK_ARG0'), "export ROCK_ARG0=clean")
        self.assertEqual(data.get('ROCK_OPTS'), "export ROCK_OPTS='ZERO TWO FIVE SIX'")

    def test_run(self):
        self.p.run('run')
        self.assertEqual(self.script, 'echo zero')

    def test_run_manual(self):
        self.p.run('run', ['echo', 'hello'])
        self.assertEqual(self.script, 'echo hello')

    def test_run_no_section(self):
        self.p = helper.project(helper.Args(name='parent'))
        self.assertRaises(ConfigError, self.p.run, 'run')

    def test_run_section_not_string(self):
        self.p = helper.project(helper.Args(name='parent'))

        self.assertRaises(ConfigError, self.p.run, 'test_str_to_dict')