| Index: tools/telemetry_tools/path_set_unittest.py
|
| diff --git a/tools/telemetry_tools/path_set_unittest.py b/tools/telemetry_tools/path_set_unittest.py
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..adeca6313c46992e8a968b7ed7390e7b8ac5c89f
|
| --- /dev/null
|
| +++ b/tools/telemetry_tools/path_set_unittest.py
|
| @@ -0,0 +1,40 @@
|
| +#!/usr/bin/env python
|
| +# Copyright (c) 2014 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import os
|
| +import unittest
|
| +
|
| +import path_set
|
| +
|
| +
|
| +class PathSetTest(unittest.TestCase):
|
| + def testCreate(self):
|
| + ps = path_set.PathSet()
|
| + self.assertEqual(len(ps), 0)
|
| + self.assertFalse(__file__ in ps)
|
| + for path in ps:
|
| + self.fail('New set is not empty.')
|
| +
|
| + ps = path_set.PathSet([__file__])
|
| + self.assertEqual(len(ps), 1)
|
| + self.assertTrue(__file__ in ps)
|
| + self.assertEqual(ps.pop(), os.path.realpath(__file__))
|
| +
|
| + def testAdd(self):
|
| + ps = path_set.PathSet()
|
| + ps.add(__file__)
|
| + self.assertEqual(len(ps), 1)
|
| + self.assertTrue(__file__ in ps)
|
| + self.assertEqual(ps.pop(), os.path.realpath(__file__))
|
| +
|
| + def testDiscard(self):
|
| + ps = path_set.PathSet([__file__])
|
| + ps.discard(__file__)
|
| + self.assertEqual(len(ps), 0)
|
| + self.assertFalse(__file__ in ps)
|
| +
|
| +
|
| +if __name__ == '__main__':
|
| + unittest.main()
|
|
|