summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-01-04 22:12:50 (GMT)
committerEvan Martin <martine@danga.com>2012-01-04 22:12:50 (GMT)
commit4a09acf125285fd773f2df0f00b2783aaa9f2f6f (patch)
tree7d4b9038061b060ff9ae38a428af924daf9f9176
parentb12139c13e8924ce4d0e634f5798274a5d87f5d7 (diff)
parent95ab954fdb060c2084bfc897172ff78e3e51334a (diff)
downloadNinja-4a09acf125285fd773f2df0f00b2783aaa9f2f6f.zip
Ninja-4a09acf125285fd773f2df0f00b2783aaa9f2f6f.tar.gz
Ninja-4a09acf125285fd773f2df0f00b2783aaa9f2f6f.tar.bz2
Merge pull request #184 from evanj/master
ninja_syntax.py: Fix passing variables to Writer.build()
-rw-r--r--misc/ninja_syntax.py2
-rwxr-xr-xmisc/ninja_test.py13
2 files changed, 14 insertions, 1 deletions
diff --git a/misc/ninja_syntax.py b/misc/ninja_syntax.py
index b73a002..8f3e309 100644
--- a/misc/ninja_syntax.py
+++ b/misc/ninja_syntax.py
@@ -66,7 +66,7 @@ class Writer(object):
' '.join(all_inputs)))
if variables:
- for key, val in variables:
+ for key, val in variables.iteritems():
self.variable(key, val, indent=1)
return outputs
diff --git a/misc/ninja_test.py b/misc/ninja_test.py
index 65dbec6..7059ae7 100755
--- a/misc/ninja_test.py
+++ b/misc/ninja_test.py
@@ -111,5 +111,18 @@ foo = a$$ $
''',
self.out.getvalue())
+class TestBuild(unittest.TestCase):
+ def setUp(self):
+ self.out = StringIO()
+ self.n = ninja_syntax.Writer(self.out)
+
+ def test_variables(self):
+ self.n.build('out', 'cc', 'in', variables={'name': 'value'})
+ self.assertEqual('''\
+build out: cc in
+ name = value
+''',
+ self.out.getvalue())
+
if __name__ == '__main__':
unittest.main()