| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/env python |
| 2 # | |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 6 | 5 |
| 7 """ | 6 """ |
| 8 IDLRelease for PPAPI | 7 IDLRelease for PPAPI |
| 9 | 8 |
| 10 This file defines the behavior of the AST namespace which allows for resolving | 9 This file defines the behavior of the AST namespace which allows for resolving |
| 11 a symbol as one or more AST nodes given a Release or range of Releases. | 10 a symbol as one or more AST nodes given a Release or range of Releases. |
| 12 """ | 11 """ |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 235 |
| 237 assert not Foo23.InRange('M13', 'M14') | 236 assert not Foo23.InRange('M13', 'M14') |
| 238 assert not Foo23.InRange('M13A', 'M14') | 237 assert not Foo23.InRange('M13A', 'M14') |
| 239 assert not Foo23.InRange('M14', 'M15') | 238 assert not Foo23.InRange('M14', 'M15') |
| 240 assert Foo23.InRange('M15', 'M16') | 239 assert Foo23.InRange('M15', 'M16') |
| 241 assert Foo23.InRange('M14', 'M15A') | 240 assert Foo23.InRange('M14', 'M15A') |
| 242 assert Foo23.InRange('M15B', 'M17') | 241 assert Foo23.InRange('M15B', 'M17') |
| 243 assert not Foo23.InRange('M16', 'M17') | 242 assert not Foo23.InRange('M16', 'M17') |
| 244 print "TestReleaseNode - Passed" | 243 print "TestReleaseNode - Passed" |
| 245 | 244 |
| 245 |
| 246 def TestReleaseListWarning(): | 246 def TestReleaseListWarning(): |
| 247 FooXX = IDLRelease(None, None) | 247 FooXX = IDLRelease(None, None) |
| 248 Foo1X = IDLRelease('M14', None) | 248 Foo1X = IDLRelease('M14', None) |
| 249 Foo23 = IDLRelease('M15', 'M16') | 249 Foo23 = IDLRelease('M15', 'M16') |
| 250 Foo45 = IDLRelease('M17', 'M18') | 250 Foo45 = IDLRelease('M17', 'M18') |
| 251 | 251 |
| 252 # Add nodes out of order should fail | 252 # Add nodes out of order should fail |
| 253 ReportClear() | 253 ReportClear() |
| 254 releases = IDLReleaseList() | 254 releases = IDLReleaseList() |
| 255 assert releases.AddNode(Foo23) | 255 assert releases.AddNode(Foo23) |
| 256 assert releases.AddNode(Foo45) | 256 assert releases.AddNode(Foo45) |
| 257 assert warning | 257 assert warning |
| 258 print "TestReleaseListWarning - Passed" | 258 print "TestReleaseListWarning - Passed" |
| 259 | 259 |
| 260 |
| 260 def TestReleaseListError(): | 261 def TestReleaseListError(): |
| 261 FooXX = IDLRelease(None, None) | 262 FooXX = IDLRelease(None, None) |
| 262 Foo1X = IDLRelease('M14', None) | 263 Foo1X = IDLRelease('M14', None) |
| 263 Foo23 = IDLRelease('M15', 'M16') | 264 Foo23 = IDLRelease('M15', 'M16') |
| 264 Foo45 = IDLRelease('M17', 'M18') | 265 Foo45 = IDLRelease('M17', 'M18') |
| 265 | 266 |
| 266 # Add nodes out of order should fail | 267 # Add nodes out of order should fail |
| 267 ReportClear() | 268 ReportClear() |
| 268 releases = IDLReleaseList() | 269 releases = IDLReleaseList() |
| 269 assert releases.AddNode(FooXX) | 270 assert releases.AddNode(FooXX) |
| 270 assert releases.AddNode(Foo23) | 271 assert releases.AddNode(Foo23) |
| 271 assert not releases.AddNode(Foo1X) | 272 assert not releases.AddNode(Foo1X) |
| 272 assert error | 273 assert error |
| 273 print "TestReleaseListError - Passed" | 274 print "TestReleaseListError - Passed" |
| 274 | 275 |
| 276 |
| 275 def TestReleaseListOK(): | 277 def TestReleaseListOK(): |
| 276 FooXX = IDLRelease(None, None) | 278 FooXX = IDLRelease(None, None) |
| 277 Foo1X = IDLRelease('M14', None) | 279 Foo1X = IDLRelease('M14', None) |
| 278 Foo23 = IDLRelease('M15', 'M16') | 280 Foo23 = IDLRelease('M15', 'M16') |
| 279 Foo45 = IDLRelease('M17', 'M18') | 281 Foo45 = IDLRelease('M17', 'M18') |
| 280 | 282 |
| 281 # Add nodes in order should work | 283 # Add nodes in order should work |
| 282 ReportClear() | 284 ReportClear() |
| 283 releases = IDLReleaseList() | 285 releases = IDLReleaseList() |
| 284 assert releases.AddNode(FooXX) | 286 assert releases.AddNode(FooXX) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 300 assert releases.FindRange('M16','M17') == [] | 302 assert releases.FindRange('M16','M17') == [] |
| 301 assert releases.FindRange(None, None) == [FooXX, Foo1X, Foo23, Foo45] | 303 assert releases.FindRange(None, None) == [FooXX, Foo1X, Foo23, Foo45] |
| 302 | 304 |
| 303 # Verify we can find the correct versions | 305 # Verify we can find the correct versions |
| 304 print "TestReleaseListOK - Passed" | 306 print "TestReleaseListOK - Passed" |
| 305 | 307 |
| 306 | 308 |
| 307 def TestReleaseMap(): | 309 def TestReleaseMap(): |
| 308 print "TestReleaseMap- Passed" | 310 print "TestReleaseMap- Passed" |
| 309 | 311 |
| 312 |
| 310 def Main(args): | 313 def Main(args): |
| 311 TestReleaseNode() | 314 TestReleaseNode() |
| 312 TestReleaseListWarning() | 315 TestReleaseListWarning() |
| 313 TestReleaseListError() | 316 TestReleaseListError() |
| 314 TestReleaseListOK() | 317 TestReleaseListOK() |
| 315 print "Passed" | 318 print "Passed" |
| 316 return 0 | 319 return 0 |
| 317 | 320 |
| 321 |
| 318 if __name__ == '__main__': | 322 if __name__ == '__main__': |
| 319 sys.exit(Main(sys.argv[1:])) | 323 sys.exit(Main(sys.argv[1:])) |
| 320 | |
| OLD | NEW |