Index: token.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.module,v
retrieving revision 1.60
diff -u -p -r1.60 token.module
--- token.module	9 Jan 2011 21:18:04 -0000	1.60
+++ token.module	12 Jan 2011 03:07:09 -0000
@@ -388,8 +388,14 @@ function token_get_global_token_types() 
  *   An array with the invalid tokens in their original raw forms.
  */
 function token_get_invalid_tokens_by_context($value, $valid_types = array()) {
-  // Add the token types that are always valid in global context.
-  $valid_types = array_merge($valid_types, token_get_global_token_types());
+  if (in_array('all', $valid_types)) {
+    $info = token_get_info();
+    $valid_types = array_keys($info['types']);
+  }
+  else {
+    // Add the token types that are always valid in global context.
+    $valid_types = array_merge($valid_types, token_get_global_token_types());
+  }
 
   $invalid_tokens = array();
   $value_tokens = is_string($value) ? token_scan($value) : $value;
Index: token.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.test,v
retrieving revision 1.31
diff -u -p -r1.31 token.test
--- token.test	9 Jan 2011 20:49:07 -0000	1.31
+++ token.test	12 Jan 2011 03:07:09 -0000
@@ -116,7 +116,7 @@ class TokenUnitTestCase extends TokenTes
         '[site:name]',
         '[site:slogan]',
         '[current-date:short]',
-        '[current-user:name]',
+        '[current-user:uid]',
         '[current-user:ip-address]',
       ),
       'invalid tokens' => array(
@@ -126,13 +126,43 @@ class TokenUnitTestCase extends TokenTes
         '[invalid:title]',
         '[site:invalid]',
         '[user:ip-address]',
+        '[user:uid]',
+        '[comment:cid]',
         // Deprecated tokens
         '[node:tnid]',
         '[node:type]',
         '[node:type-name]',
+        '[date:short]',
       ),
       'types' => array('node'),
     );
+    $tests[] = array(
+      'valid tokens' => array(
+        '[node:title]',
+        '[node:created:short]',
+        '[node:created:custom:invalid]',
+        '[node:created:custom:mm-YYYY]',
+        '[site:name]',
+        '[site:slogan]',
+        '[user:uid]',
+        '[comment:cid]',
+        '[current-date:short]',
+        '[current-user:uid]',
+      ),
+      'invalid tokens' => array(
+        '[node:title:invalid]',
+        '[node:created:invalid]',
+        '[node:created:short:invalid]',
+        '[invalid:title]',
+        '[site:invalid]',
+        '[user:ip-address]',
+        // Deprecated tokens
+        '[node:tnid]',
+        '[node:type]',
+        '[node:type-name]',
+      ),
+      'types' => array('all'),
+    );
 
     foreach ($tests as $test) {
       $tokens = array_merge($test['valid tokens'], $test['invalid tokens']);
@@ -142,7 +172,7 @@ class TokenUnitTestCase extends TokenTes
 
       sort($invalid_tokens);
       sort($test['invalid tokens']);
-      $this->assertEqual($invalid_tokens, $test['invalid tokens'], 'Invalid tokens detected properly.');
+      $this->assertEqual($invalid_tokens, $test['invalid tokens'], 'Invalid tokens detected properly: ' . implode(', ', $invalid_tokens));
     }
   }
 }
