├── asmake ├── TODO ├── .gitattributes ├── ASUnit.applescript ├── makefile.applescript ├── test ├── Resources │ └── Script Libraries │ │ └── com.lifepillar │ │ └── ASUnit.applescript └── Test ASUnit.applescript ├── templates ├── MyScript.applescript ├── Test Template.applescript └── Runtime Loader.applescript ├── assets └── asunit_logo-208x64.png ├── examples ├── HexString.applescript ├── Test HexString.applescript ├── Test AppleScript Variable Types and You.applescript └── Test Loader.applescript ├── .gitignore ├── Documentation └── ASUnit_applescript │ ├── Classes │ ├── ASUnitSentinel │ │ ├── toc.html │ │ └── index.html │ ├── Observer │ │ └── toc.html │ ├── ConsoleLogger │ │ └── toc.html │ ├── StdoutLogger │ │ └── toc.html │ ├── Visitor │ │ └── toc.html │ ├── TestComponent │ │ └── toc.html │ ├── ScriptEditorLogger │ │ └── toc.html │ ├── TestCase │ │ └── toc.html │ └── TestLogger │ │ └── toc.html │ ├── parsedFunctionContents_makeTestSuite │ └── Classes │ │ └── TestSuite │ │ └── toc.html │ ├── parsedFunctionContents_makeTestResult │ └── Classes │ │ └── TestResult │ │ └── toc.html │ ├── toc.html │ └── parsedFunctionContents_makeAssertions │ └── Classes │ └── TestAssertions │ └── toc.html ├── README.md ├── OldManual.md └── COPYING /asmake: -------------------------------------------------------------------------------- 1 | ./makefile.applescript -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | - sdef. 2 | - Localization. 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.applescript diff 2 | *.applescript encoding=macroman 3 | -------------------------------------------------------------------------------- /ASUnit.applescript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifepillar/ASUnit/HEAD/ASUnit.applescript -------------------------------------------------------------------------------- /makefile.applescript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifepillar/ASUnit/HEAD/makefile.applescript -------------------------------------------------------------------------------- /test/Resources/Script Libraries/com.lifepillar/ASUnit.applescript: -------------------------------------------------------------------------------- 1 | ../../../../ASUnit.applescript -------------------------------------------------------------------------------- /templates/MyScript.applescript: -------------------------------------------------------------------------------- 1 | -- Dummy script for the test template 2 | on run 3 | return me 4 | end -------------------------------------------------------------------------------- /assets/asunit_logo-208x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifepillar/ASUnit/HEAD/assets/asunit_logo-208x64.png -------------------------------------------------------------------------------- /examples/HexString.applescript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifepillar/ASUnit/HEAD/examples/HexString.applescript -------------------------------------------------------------------------------- /test/Test ASUnit.applescript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifepillar/ASUnit/HEAD/test/Test ASUnit.applescript -------------------------------------------------------------------------------- /examples/Test HexString.applescript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifepillar/ASUnit/HEAD/examples/Test HexString.applescript -------------------------------------------------------------------------------- /templates/Test Template.applescript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifepillar/ASUnit/HEAD/templates/Test Template.applescript -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *~ 3 | *.scpt 4 | ASUnit-*/ 5 | OldManual.html 6 | README.html 7 | *.tar.gz 8 | tmp 9 | /Documentation/**/*-temp* 10 | -------------------------------------------------------------------------------- /examples/Test AppleScript Variable Types and You.applescript: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifepillar/ASUnit/HEAD/examples/Test AppleScript Variable Types and You.applescript -------------------------------------------------------------------------------- /examples/Test Loader.applescript: -------------------------------------------------------------------------------- 1 | (*! 2 | @header 3 | @abstract 4 | Template test loader. 5 | @discussion 6 | Runs all the test scripts in the current folder. 7 | @charset macintosh 8 | *) 9 | property parent : script "com.lifepillar/ASUnit" 10 | 11 | set pwd to (the folder of file (path to me) of application "Finder") 12 | set suite to makeTestLoader()'s loadTestsFromFolder(pwd) 13 | autorun(suite) 14 | -------------------------------------------------------------------------------- /templates/Runtime Loader.applescript: -------------------------------------------------------------------------------- 1 | (*! @header 2 | @abstract 3 | Illustrates a trick to load ASUnit at runtime. 4 | @discussion 5 | This script shows a method to load ASUnit at runtime. Why would you want to do that? 6 | Suppose that you want to load ASUnit.scptd from the same folder containing the test 7 | script. You may determine the path where the script is saved with path to me, 8 | but path to me does not evaluate to the correct path if it is executed at 9 | compile-time. 10 | 11 | The drawback of this method is that it breaks test loaders (but it can be used for 12 | the test loader itself, i.e., the test loader can import ASUnit at runtime). 13 | All in all, loading scripts at compile time is probably the best thing to do. 14 | *) 15 | property ASUnit : missing value 16 | property suite : missing value 17 | property dir : missing value 18 | 19 | on run 20 | set my dir to (folder of folder of file (path to me) of application "Finder") as text 21 | set ASUnit to run script ((my dir) & "ASUnit.applescript") as alias 22 | set suite to ASUnit's makeTestSuite("Test Template") 23 | tests() -- Register tests at runtime to be able to inherit from source code, and run them 24 | ASUnit's autorun(suite) 25 | end run 26 | 27 | -- Make TestSet() and UnitTest() visible to nested scripts for convenience 28 | on TestSet(t) 29 | ASUnit's TestSet(t) 30 | end TestSet 31 | 32 | on UnitTest(t) 33 | ASUnit's UnitTest(t) 34 | end UnitTest 35 | 36 | -- Tests are defined here: 37 | 38 | on tests() 39 | script TestCaseTemplate 40 | property parent : TestSet(me) 41 | 42 | on setUp() 43 | end setUp 44 | 45 | on tearDown() 46 | end tearDown 47 | 48 | script testOne 49 | property parent : UnitTest(me) 50 | should(1 + 1 = 2, "1+1 is not 2") 51 | end script 52 | 53 | script testTwo 54 | property parent : UnitTest(me) 55 | shouldnt(1 + 1 = 3, "1+1 is 3") 56 | end script 57 | end script -- TestCaseTemplate 58 | end tests 59 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/ASUnitSentinel/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for ASUnitSentinel (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 70 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 64 | 65 |
Class:
  ASUnitSentinel
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 |

Other Reference

42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
Header
51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
61 |
62 | 63 |
66 |

 

67 |

68 |

69 |
71 | 72 | 73 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/Observer/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for Observer (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 88 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 82 | 83 |
Class:
  Observer
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 56 |
57 |
58 |
59 |

Other Reference

60 |
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Header
69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
79 |
80 | 81 |
84 |

 

85 |

86 |

87 |
89 | 90 | 91 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/ConsoleLogger/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for ConsoleLogger (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 88 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 82 | 83 |
Class:
  ConsoleLogger
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 56 |
57 |
58 |
59 |

Other Reference

60 |
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Header
69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
79 |
80 | 81 |
84 |

 

85 |

86 |

87 |
89 | 90 | 91 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/StdoutLogger/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for StdoutLogger (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 88 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 82 | 83 |
Class:
  StdoutLogger
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 56 |
57 |
58 |
59 |

Other Reference

60 |
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Header
69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
79 |
80 | 81 |
84 |

 

85 |

86 |

87 |
89 | 90 | 91 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/Visitor/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for Visitor (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 89 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 83 | 84 |
Class:
  Visitor
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 57 |
58 |
59 |
60 |

Other Reference

61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
Header
70 |
71 |
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
80 |
81 | 82 |
85 |

 

86 |

87 |

88 |
90 | 91 | 92 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/TestComponent/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for TestComponent (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 90 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 84 | 85 |
Class:
  TestComponent
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 58 |
59 |
60 |
61 |

Other Reference

62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
Header
71 |
72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
81 |
82 | 83 |
86 |

 

87 |

88 |

89 |
91 | 92 | 93 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/parsedFunctionContents_makeTestSuite/Classes/TestSuite/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for TestSuite (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 90 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 84 | 85 |
Class:
  TestSuite
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 58 |
59 |
60 |
61 |

Other Reference

62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
Header
71 |
72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
81 |
82 | 83 |
86 |

 

87 |

88 |

89 |
91 | 92 | 93 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/ScriptEditorLogger/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for ScriptEditorLogger (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 90 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 84 | 85 |
Class:
  ScriptEditorLogger
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 58 |
59 |
60 |
61 |

Other Reference

62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
Header
71 |
72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
81 |
82 | 83 |
86 |

 

87 |

88 |

89 |
91 | 92 | 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![ASUnit Logo](./assets/asunit_logo-208x64.png) 2 | 3 | 4 | # ASUnit 5 | 6 | [ASUnit][] is a unit testing framework for AppleScript derived from the 7 | original [codebase][ASUnit-original][^1]. For a detailed description of the 8 | architecture of the original ASUnit framework, read the [old 9 | manual](./OldManual.md); some advanced features of ASUnit (such as custom 10 | `TestCase` and `Visitor` objects) are still described only in that document. 11 | 12 | ASUnit's API is now thoroughly commented using 13 | [HeaderDoc][Wikipedia-HeaderDoc]. 14 | 15 | 16 | ## Download 17 | 18 | Visit [Releases](https://github.com/lifepillar/ASUnit/releases) to download the 19 | current release. 20 | 21 | Alternatively, clone the repository from GitHub: 22 | 23 | ```sh 24 | git clone https://github.com/lifepillar/ASUnit.git 25 | ``` 26 | 27 | ### Advanced Download Method 28 | 29 | If for some reason you want to download a specific version of ASUnit from the 30 | terminal or with a shell script, you may adapt the following commands: 31 | 32 | ```sh 33 | VERSION="1.2.5" 34 | TARBALL="${VERSION}.tar.gz" 35 | ASUNIT_BASE_URL="https://github.com/lifepillar/ASUnit/" 36 | TARBALL_URL="${ASUNIT_BASE_URL}/archive/refs/tags/${TARBALL}" 37 | cd ~/Downloads 38 | curl -O "${TARBALL_URL}" 39 | tar zxvf "${TARBALL}" 40 | ``` 41 | 42 | Or, if you prefer a Zip archive: 43 | 44 | ```sh 45 | VERSION="1.2.5" 46 | ZIPFILE="${VERSION}.zip" 47 | ASUNIT_BASE_URL="https://github.com/lifepillar/ASUnit/" 48 | ZIPFILE_URL="${ASUNIT_BASE_URL}/archive/refs/tags/${ZIPFILE}" 49 | cd ~/Downloads 50 | curl -O "${ZIPFILE_URL}" 51 | unzip "${ZIPFILE}" 52 | ``` 53 | 54 | Change `VERSION` above to match the version you want to download. 55 | 56 | 57 | ## Install 58 | 59 | Once you have downloaded ASUnit, to build and install it you may proceed in two 60 | different ways. 61 | 62 | 1. If you use `AppleScript` 2.4 (OS X 10.10 "Yosemite") or later and have 63 | installed [ASMake][], you may just write: 64 | 65 | ```sh 66 | cd ASUnit 67 | ./asmake install 68 | ``` 69 | 70 | 2. Otherwise, you can install it manually with the following commands: 71 | 72 | ```sh 73 | cd ASUnit 74 | osacompile -o ASUnit.scptd -x ASUnit.applescript 75 | mkdir -p "${HOME}/Library/Script Libraries/com.lifepillar" 76 | mv ASUnit.scptd "${HOME}/Library/Script Libraries/com.lifepillar" 77 | ``` 78 | 79 | In either case, the file `ASUnit.scptd` will be installed in 80 | `~/Library/Script Libraries/com.lifepillar`. 81 | 82 | 83 | ## Importing ASUnit 84 | 85 | To use ASUnit, add one of the two properties below to your script in order to 86 | import the library. 87 | 88 | If you have `AppleScript` 2.3 (OS X 10.9 "Mavericks") or later, use this: 89 | 90 | ```applescript 91 | property parent : script "com.lifepillar/ASUnit" 92 | ``` 93 | 94 | If you have an older, pre-Mavericks system, use this instead: 95 | 96 | ```applescript 97 | property parent : ¬ 98 | load script (((path to library folder from user domain) as text) ¬ 99 | & "Script Libraries:com.lifepillar:ASUnit.scptd") as alias 100 | ``` 101 | 102 | 103 | ## Running Tests 104 | 105 | Your test script must define a `suite` property and pass it to ASUnit's 106 | `autorun()` handler: 107 | 108 | ```applescript 109 | property suite : makeTestSuite("A description for my tests") 110 | autorun(suite) 111 | ``` 112 | 113 | You may run the test script in various ways: inside Script Editor, from the 114 | command-line using `osascript`, or in other environments ([Script 115 | Debugger][ScriptDebugger], AppleScriptObjC Explorer). 116 | 117 | When you have several test files, you may run them all at once using a *test 118 | loader* (there is no need to compile them in advance). See `Test 119 | Loader.applescript` in the [examples](./examples/) folder. 120 | 121 | 122 | ### Logging 123 | 124 | By default, if you run the tests in [Script Editor][ScriptEditor-doc], the 125 | output is written to a new Script Editor document; if you run the tests 126 | in the [Terminal][Terminal-doc], the output is sent to stdout; otherwise, 127 | the output is sent to the current system logger through `log` statements; 128 | access them via [Console][Console-doc]. 129 | 130 | You may, however, change this by setting the `suite's loggers` property. The 131 | value of this property must be a list of *loggers* (you may send the output to 132 | more than one destination). Currently, ASUnit defines three loggers: 133 | 134 | - `AppleScriptEditorLogger`: sends colored output to a Script Editor window; 135 | - `StdoutLogger`: sends colored output to stdout. 136 | - `ConsoleLogger`: prints the output using `log` statements (most portable logger). 137 | 138 | Defining custom loggers should be fairly easy: you simply need to define 139 | a script that inherits from `TestLogger` and override the `print…()` handlers 140 | to generate the output you want. A more advanced alternative consists in 141 | subclassing `Visitor`: you may find an example in the [old 142 | manual](./OldManual.md#creating-new-operations-on-a-test-suite). 143 | 144 | 145 | ## Writing Tests 146 | 147 | A test template is provided in the [templates](./templates/) folder. See the 148 | [examples](./examples/) folder for complete examples. The general structure of 149 | a test script is as follows: 150 | 151 | ```applescript 152 | script |One test set| 153 | property parent : TestSet(me) 154 | 155 | on setUp() 156 | -- Code executed before each unit test 157 | end 158 | 159 | on tearDown() 160 | -- Code executed after each unit test 161 | end 162 | 163 | script |a test| 164 | property parent : UnitTest(me) 165 | 166 | assert(1 + 1 = 2, "one plus one should be two") 167 | assertEqual(2, 1 + 1) 168 | refute(3 = 1 + 1, "1 + 1 should not be 3") 169 | end script 170 | 171 | script |another test| 172 | property parent : UnitTest(me) 173 | -- More assertions… 174 | end 175 | end script 176 | 177 | script |Another test set| 178 | property parent : TestSet(me) 179 | -- More tests… 180 | end 181 | ``` 182 | 183 | Each unit test is a script that inherits from `UnitTest(me)`. Inside such 184 | scripts, you may make a number of assertions. 185 | 186 | 187 | ### Assertions 188 | 189 | Below, “iff” stands for [“if and only if”][Wikipedia-iff]. 190 | 191 | - `skip(msg)`: skips the current test. 192 | - `fail(msg)`: makes the test unconditionally fail. 193 | - `ok(expr)`: succeeds iff the boolean `expr` evaluates to true. 194 | - `notOk(expr)`: succeeds iff `expr` evaluates to false. 195 | - `assert(expr, msg)` or `should(expr, msg)`: succeeds iff `expr` is true. 196 | - `refute(expr, msg)` or `shouldnt(expr, msg)`: succeeds iff `expr` is false. 197 | - `shouldRaise(num, object, msg)`: succeeds iff `object` raises exception `num` when executed. 198 | The `object` can be a script object or a handler without parameters. 199 | - `shouldNotRaise(num, object, msg)`: succeeds iff `object` does not raise exception `num` when executed. 200 | The `object` can be a script object or a handler without parameters. 201 | - `assertEqual(expr, value)` or `shouldEqual(expr, value)`: succeeds iff `expr` = `value`. 202 | - `refuteEqual(expr, value)` or `shouldNotEqual(expr, value)`: succeeds iff `expr` ≠ `value`. 203 | - `assertMissing(expr)`: a synonym for `assertEqual(missing value, expr)`. 204 | - `assertObjCReference(expr)`: succeeds iff `expr` is a reference to a Cocoa object. 205 | - `refuteObjCReference(expr)`: succeeds iff `expr` is not a reference to a Cocoa object. 206 | - `refuteMissing(expr)`: a synonym for `assertNotEqual(missing value, expr)`. 207 | - `assertNull(expr)`: a synonym for `assertEqual(null, expr)`. 208 | - `refuteNull(expr)`: a synonym for `assertNotEqual(null, expr)`. 209 | - `assertEqualAbsError(e1, e2, delta)`: succeeds iff `|e1-e2| <= delta`. 210 | - `assertEqualRelError(e1, e2, eps)`: succeeds iff `|e1-e2| <= min(|e1|,|e2|) * eps`. 211 | - `assertReference(x)` or `shouldBeReference(x)`: succeeds iff `x` is a reference. 212 | - `assertNotReference(x)` or `shouldNotBeReference(x)`: succeeds iff `x` is not a reference. 213 | - `assertInstanceOf(aClass, expr)`: succeeds iff the class of `expr` is equal to `aClass`. 214 | - `refuteInstanceOf(aClass, expr)`: succeeds iff the class of `expr` is not `aClass`. 215 | - `assertKindOf(aClass, expr)`: succeeds iff `expr` or any of its ancestors belongs to `aClass`. 216 | - `refuteKindOf(aClass, expr)`: succeeds iff neither `expr` nor any of its ancestors belong to `aClass`. 217 | - `assertInheritsFrom(a, b)`: succeeds iff `b` (directly or indirectly) inherits from `a`. 218 | - `refuteInheritsFrom(a, b)`: succeeds iff `b` does not inherit from `a`. 219 | 220 | Some of the assertions take a textual message as an argument (`msg` parameter), 221 | which is printed when the assertion fails. 222 | 223 | A clarification is in order for the last three types of assertions. Consider 224 | the following two scripts: 225 | 226 | ```applescript 227 | script A 228 | property class : "Father" 229 | end script 230 | 231 | script B 232 | property parent : A 233 | property class : "Child" 234 | end script 235 | ``` 236 | 237 | Then, these assertions must succeed: 238 | 239 | ```applescript 240 | assertInstanceOf("Father", A) 241 | assertInstanceOf("Child", B) 242 | refuteInstanceOf("Father", B) 243 | assertKindOf("Father", B) 244 | refuteInstanceOf(script, A) 245 | assertKindOf(script, A) 246 | assertInheritsFrom(A, B) 247 | refuteInheritsFrom(B, A) 248 | ``` 249 | 250 | Related unit tests can be grouped together into a script that must inherit from 251 | `TestSet(me)`. One advantage of grouping tests is that you may define `setUp()` 252 | and `tearDown()` operations that are automatically executed before and after 253 | each unit test, respectively. Such handlers can be used for initialization of 254 | data structures and clean up operations, and help ensure that each unit test is 255 | not affected by the behavior of the others. 256 | 257 | Note that the names of the scripts are used in the output. For this reason, you 258 | may want to use short sentences enclosed between vertical bars as script names, 259 | as it was done in the example above. Alternatively, you may define the `name` 260 | property of the script explicitly. 261 | 262 | 263 | ## Copyright 264 | 265 | Copyright © 2013 Lifepillar, 2006 Nir Soffer. All rights reserved. 266 | 267 | 268 | ## License 269 | 270 | This software is licensed under the [GNU GPL-2.0][GNU-GPLv2] License, see COPYING for details. 271 | 272 | 273 | [^1]: The original framework codebase was written by Nir Soffer. 274 | [^2]: `Script Editor` was called `AppleScript Editor` from 2009 to 2014 but it's the same program. 275 | 276 | 277 | [//]: # (Cross reference section) 278 | 279 | [ASMake]: https://github.com/lifepillar/ASMake/ 280 | [ASUnit]: https://github.com/lifepillar/ASUnit/ 281 | [ASUnit-tags]: https://github.com/lifepillar/ASUnit/tags 282 | [ASUnit-original]: http://nirs.freeshell.org/asunit/ 283 | [Console-doc]: https://support.apple.com/guide/console/welcome/mac 284 | [GNU-GPLv2]: https://opensource.org/license/gpl-2-0 285 | [HeaderDoc-doc]: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/HeaderDoc/intro/intro.html 286 | [ScriptDebugger]: https://www.latenightsw.com "Script Debugger" 287 | [ScriptEditor-doc]: https://support.apple.com/guide/script-editor/welcome/mac 288 | [Terminal-doc]: https://support.apple.com/guide/terminal/welcome/mac 289 | [Wikipedia-HeaderDoc]: https://en.wikipedia.org/wiki/HeaderDoc 290 | [Wikipedia-iff]: https://simple.wikipedia.org/wiki/If_and_only_if 291 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/TestCase/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for TestCase (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 113 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 107 | 108 |
Class:
  TestCase
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 63 |
64 |
65 |
66 | 67 | 68 | 69 | 70 | 71 | 74 | 75 |
72 | Member Data 73 |
76 |
77 | 78 | 81 |
82 |
83 |
84 |

Other Reference

85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 |
Header
94 |
95 |
96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 |
104 |
105 | 106 |
109 |

 

110 |

111 |

112 |
114 | 115 | 116 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/TestLogger/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for TestLogger (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 105 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 99 | 100 |
Class:
  TestLogger
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 | 74 |
75 |
76 |

Other Reference

77 |
78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
Header
86 |
87 |
88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
96 |
97 | 98 |
101 |

 

102 |

103 |

104 |
106 | 107 | 108 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/parsedFunctionContents_makeTestResult/Classes/TestResult/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for TestResult (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 124 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 118 | 119 |
Class:
  TestResult
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Member Functions 48 |
51 |
52 | 53 | 74 |
75 |
76 |
77 | 78 | 79 | 80 | 81 | 82 | 85 | 86 |
83 | Member Data 84 |
87 |
88 | 89 | 92 |
93 |
94 |
95 |

Other Reference

96 |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 |
Header
105 |
106 |
107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 |
115 |
116 | 117 |
120 |

 

121 |

122 |

123 |
125 | 126 | 127 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for ASUnit (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 140 |
 
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 134 | 135 |
Header:
  ASUnit
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
Introduction
39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
47 | Functions 48 |
51 | 68 |
69 |
70 | 71 | 72 | 73 | 74 | 75 | 78 | 79 |
76 | Classes 77 |
80 |
81 | 92 |
93 |
94 |
95 | 96 | 97 | 98 | 99 | 100 | 103 | 104 |
101 | Globals 102 |
105 |
106 | 107 | 118 |
119 |
120 |
121 |

Other Reference

122 |
123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 |
131 |
132 | 133 |
136 |

 

137 |

138 |

139 |
141 | 142 | 143 | -------------------------------------------------------------------------------- /OldManual.md: -------------------------------------------------------------------------------- 1 | # ASUnit, an AppleScript testing framework # 2 | 3 | - - - 4 | **As of version 0.5, this document is partially obsolete.** 5 | **Please refer to the [README](README.md).** 6 | **The original version of this document is available [here].** 7 | 8 | [here]: http://nirs.freeshell.org/asunit/ "here" 9 | - - - 10 | 11 | ASUnit is testing framework for AppleScript, influenced by SUnit, ASTest 12 | and Python [unittest][unittest] module. 13 | 14 | [unittest]: http://docs.python.org/lib/module-unittest.html "unittest" 15 | 16 | Features: 17 | 18 | * Easy to install, no dependencies, minimal boilerplate code. 19 | * Automatic and manual test case registration. 20 | * Runs in *AppleScript Editor*, displays results in a new document. 21 | * Aggregates multiple test scripts. 22 | 23 | This text is mostly a shameless copy of Kent Beck's [SmallTalk testing framework][SmallTalk], modified for ASUnit. 24 | 25 | [SmallTalk]: http://www.xprogramming.com/testfram.htm "SmallTalk testing framework" 26 | 27 | 28 | ## Installation 29 | 30 | To use ASUnit, unzip and copy the file `ASUnit.scpt` to the Scripts folder, either in 31 | your Library folder, or in the global Library folder in the startup disk. 32 | 33 | To use in a script, your test script should inherit from ASUnit. In the example, ASUnit 34 | was installed in the global Library folder (local domain): 35 | 36 | property parent : load script file ((path to scripts folder from local domain as string) & "ASUnit.scpt") 37 | 38 | 39 | ## Cookbook 40 | 41 | Here is a simple pattern system for writing tests. The patterns are: 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
Fixturecreate a common test fixture
Test Casecreate the stimulus for a test case
Checkcheck the response for a test case
Test Suiteaggregate Test Cases
Test Runnerrun a test suite and display results
Test Loaderaggregate test scripts
51 | 52 | ### Fixture 53 | 54 | A fixture is a certain configuration of the system, required to test a certain feature. 55 | A complete test for a community of objects will have many fixtures, each of which will 56 | be tested in many ways. 57 | 58 | #### Design a test fixture 59 | 60 | 1. Create fixture script, inheriting from TestCase. 61 | 2. Add properties for each known object in the fixture. 62 | 3. Override `setUp()` to initialize the properties. 63 | 64 | AppleScript lacks introspection, so registering of fixtures is done by using factory 65 | methods during compile time. Instead of inheriting from `TestCase` directly, call 66 | `registerFixture()`, which registers the fixture and makes your script inherit 67 | from `TestCase`. 68 | 69 | In the example, the test fixture is two lists, one empty and one with elements. 70 | First create a script object, then add properties for the objects we need to reference 71 | later: 72 | 73 | script |accessing list| 74 | property parent : registerFixture(me) 75 | 76 | property empty : missing value 77 | property notEmpty : missing value 78 | 79 | Then override `setUp()` to create the objects for the fixture:: 80 | 81 | on setUp() 82 | set empty to {} 83 | set notEmpty to {"foo", 1} 84 | end 85 | 86 | 87 | ### Test Case 88 | 89 | You have a Fixture, what do you do next? 90 | 91 | #### How do you represent a single unit of testing? 92 | 93 | Each test of the fixture is represented by a script object in the fixture. 94 | Test scripts uses the fixture `setUp()` and `tearDown()` handlers to make sure 95 | different tests do not interfere with each other. 96 | 97 | #### Represent a predictable reaction of a fixture as a script object 98 | 99 | 1. Add a script object inheriting from the fixture. 100 | 2. Stimulate the fixture in the *test* method. 101 | 102 | Again, you don't inherit directly from the fixture, but call `registerTestCase()`, 103 | which registers the test case and makes it inherit from the current fixture. 104 | 105 | We can predict that adding "bar" to an empty list will result in "bar" being in the 106 | list. Add a script object to the fixture, and stimulate the fixture in its run handler: 107 | 108 | script |add item| 109 | property parent : registerTestCase(me) 110 | set end of empty to "bar" 111 | ... 112 | end 113 | 114 | Once you have stimulated the fixture, you need to add a Check to make sure your 115 | prediction came true. 116 | 117 | 118 | ### Check 119 | 120 | A Test Case stimulates a Fixture. 121 | 122 | #### How do you test for expected results? 123 | 124 | If you're testing interactively, you check for expected results directly in the results 125 | or event log pane. You want a way to programmatically look for problems. One way to 126 | accomplish this is to use the standard error handling mechanism with testing logic to 127 | signal errors: 128 | 129 | if empty does not contain "bar" then error "where is bar?!" 130 | 131 | When you're testing, you'd like to distinguish between errors you are checking for, 132 | like getting six as the sum of two and three, and errors you didn't anticipate, like 133 | subscripts being out of bounds or messages not being understood. 134 | 135 | When a catastrophic error occurs, the framework stops running the test case, records 136 | the error, and runs the next test case. Since each test case has its own fixture, the 137 | error in the previous case will not affect the next. 138 | 139 | The testing framework makes checking for expected values simple by providing a method, 140 | should, that takes an expression as first argument, and an error message as second 141 | argument. If the expression evaluates to true, everything is fine. Otherwise, the test 142 | case stops running, the failure is recorded with the error message, and the next test 143 | case runs. 144 | 145 | #### Check by calling *should* with an expression 146 | 147 | In the example, after stimulating the fixture by adding "bar" to an empty list, 148 | we want to check and make sure it's in there: 149 | 150 | script |add item| 151 | property parent : registerTestCase(me) 152 | set end of empty to "bar" 153 | should(empty contains "bar", "no bar?!") 154 | end 155 | 156 | There is a variant on `should()`. `shouldnt()` causes the test case to fail if the 157 | expression argument evaluates to true. It is there so you don't have to use "not 158 | (...)". 159 | 160 | Once you have a test case, you can run it. Send `test()` to the script object: 161 | 162 | |accessing list|'s |add item|'s test() 163 | 164 | If it runs to completion, the test worked. If you get an error, something went wrong. The result of sending `test()` to a `TestCase` is a `TestResult` object. 165 | 166 | 167 | ### Test Suite 168 | 169 | You have several Test Cases. 170 | 171 | #### How do you run lots of tests? 172 | 173 | Soon you will have many test cases, and fixtures. You could just string together a 174 | bunch of expressions to run test cases. However, when you then wanted to run "this 175 | bunch of cases and that bunch of cases" you'd be stuck. 176 | 177 | The testing framework provides an object to represent "a bunch of tests", `TestSuite`. 178 | A `TestSuite` runs a collection of test cases and reports their results all at once. 179 | `TestSuite`s can also contain other `TestSuite`s, so you can put Joe's tests and 180 | Tammy's tests together by creating a higher level suite. 181 | 182 | #### Combine test cases into a test suite 183 | 184 | Tests are automatically collected in each script file. To make this happen, you must 185 | create a property named `suite` and initialize it with a `TestSuite` in each ASUnit 186 | test script. As usual, you use a factory function for that. 187 | 188 | Add this code at the start of your test script using a descriptive name for the test 189 | suite: 190 | 191 | property suite : makeTestSuite("Test Suite Name") 192 | 193 | To run all the tests in the the current file, tell suite to test: 194 | 195 | set results to suite's test() 196 | 197 | The result of sending `test()` to a `TestSuite` is a `TestResult` object. It records 198 | all the test cases including their failures or errors, and the time at which the suite 199 | was run. 200 | 201 | 202 | ### Test Runner 203 | 204 | Running a `TestSuite` and inspecting the `TestResult` returned is not very convenient. 205 | You would like to click one button to run a suite of tests. The framework supplies a 206 | `TextTestRunner`, which runs a `TestSuite` and displays progress and test results. 207 | 208 | To run the suite in a test script, create a `TextTestRunner` and tell it to run: 209 | 210 | run makeTextTestRunner(suite) 211 | 212 | Now when you click the *Run* button in *AppleScript Editor*, the test will run and you 213 | will get a test report in a new *AppleScript Editor* document. 214 | 215 | 216 | ### Test Loader 217 | 218 | Soon you will have more than one test script. It is too much work to open each and run 219 | the tests each time. The framework supplies a `TestLoader`, which searches for tests 220 | scripts in folders, and returns a suite with all the tests. The `TestLoader` looks for 221 | file names that start with *Test* and ends with *.scpt*, like *Test Module.scpt*, in 222 | the folder you specify. 223 | 224 | To collect and run all the test scripts in the current directory, create this script: 225 | 226 | property currentFolder : folder of file (document 1's path as POSIX file) of application "Finder" 227 | property parent : load script file ((path to scripts folder from local domain as string) & "ASUnit.scpt") 228 | set suite to makeTestLoader()'s loadTestsFromFolder(currentFolder) 229 | run makeTextTestRunner(suite) 230 | 231 | Now you may open a single script and click the *Run* button to run all your test 232 | scripts. 233 | 234 | 235 | ### Example Test Script 236 | 237 | Here is an example test script you can use as a template for your scripts:: 238 | 239 | property parent : load script file ((path to scripts folder from local domain as string) & "ASUnit.scpt") 240 | property suite : makeTestSuite("My Tests") 241 | 242 | script |accessing list| 243 | property parent : registerFixture(me) 244 | property empty : missing value 245 | property notEmpty : missing value 246 | 247 | on setUp() 248 | set empty to {} 249 | set notEmpty to {"foo", 1} 250 | end setUp 251 | 252 | script |add item| 253 | property parent : registerTestCase(me) 254 | set end of empty to "bar" 255 | should(empty contains "bar", "no bar?!") 256 | end script 257 | 258 | script |add same item| 259 | property parent : registerTestCase(me) 260 | set end of notEmpty to "foo" 261 | should(last item of notEmpty is "foo", "first foo vanished?!") 262 | should(first item of notEmpty is "foo", "where is last foo?!") 263 | end script 264 | end script 265 | 266 | run makeTextTestRunner(suite) 267 | 268 | 269 | ## Customizing the Framework 270 | 271 | ### Creating your own TestCase class 272 | 273 | It is common to have helper handlers needed by multiple fixtures. It is also possible 274 | to change the behavior of `TestCase` to adapt to special needs. To create your own 275 | `TestCase`, create a script inheriting from `TestCase`, and let the concrete fixture inherit from it. To create a fixture, use `makeFixture()`. To register a fixture that 276 | inherits from a custom class, use `registerFixtureOfKind()`: 277 | 278 | script |user defined TestCase| 279 | property parent : makeFixture() 280 | end 281 | 282 | script |concrete fixture| 283 | property parent: registerFixtureOfKind(me, |user defined TestCase|) 284 | 285 | script |test case| 286 | property parent : registerTestCase(me) 287 | -- add test code here 288 | end 289 | end 290 | 291 | 292 | ### Creating your own TestSuite class 293 | 294 | It is rarely need to customize `TestSuite`. If you want to change the way test results 295 | are collected, create your own `TestResult` class. If you want to do new operations on 296 | a `TestSuite`, create a new visitor class inheriting from `Visitor`. However if you do 297 | need to create your own `TestSuite`, you can create a script inheriting from 298 | `TestSuite`, and set the suite property to your own `TestSuite`: 299 | 300 | script MyTestSuite 301 | property parent : makeTestSuite(my name) 302 | end 303 | property suite : MyTestSuite 304 | 305 | 306 | ### Creating your own TestResult class 307 | 308 | To change the testing policy or the way results are collected, you can define your own 309 | TestResult class inheriting from `TestResult`: 310 | 311 | script MyTestResult 312 | property parent : makeTestResult("Test name") 313 | end 314 | 315 | To run a test case or suite with your own `TestResult`, call `runTest()` on the 316 | `TestResult` object with the test case or suite as argument: 317 | 318 | MyTestResult runTest(aSuite) 319 | 320 | To use a `TextTestRunner` with your own `TestResult`, call `setTestResult()` 321 | before running: 322 | 323 | set runner to makeTextTestRunner(suite) 324 | runner's setTestResult(MyTestResult) 325 | run runner 326 | 327 | 328 | ### Creating new operations on a test suite 329 | 330 | If you want to add a new feature to a test suite, create a visitor that implement the 331 | new feature. Here is an example of HTML formatter that formats a list of the test in 332 | the suite: 333 | 334 | script HTMLFormatter 335 | property parent : Visitor 336 | property html : missing value 337 | 338 | on format(aTest) 339 | set html to {} 340 | set end of html to "
    " & return 341 | aTest's accept(me) 342 | set end of html to "
" & return 343 | return html as string 344 | end 345 | 346 | on visitTestCase(aTestCase) 347 | set end of html to "
  • " & aTestCase's fullName() & "
  • " & return 348 | end 349 | 350 | end 351 | 352 | To get a list of test cases use: 353 | 354 | HTMLFormatter's format(suite) 355 | 356 | 357 | ### Creating your own TestRunner 358 | 359 | You can create whatever runner you like, there is no special API your runner must 360 | implement. However if you want to be notified about running suites and tests, and about 361 | single test cases results, you should set your runner as observer of the `TestResult`. 362 | See the source of `TextTestRunner` for example. 363 | 364 | 365 | ## Copyright 366 | 367 | Copyright © 2006 Nir Soffer. All rights reserved. 368 | 369 | ## License 370 | 371 | This software is licensed under the [GNU GPL-2.0][GNU-GPLv2] License, see COPYING for details. 372 | 373 | [//]: # (Cross reference section) 374 | 375 | [GNU-GPLv2]: https://opensource.org/license/gpl-2-0 376 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/parsedFunctionContents_makeAssertions/Classes/TestAssertions/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Documentation for TestAssertions (ASUnit.applescript) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 148 |
     
    16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 142 | 143 |
    Class:
      TestAssertions
    29 | 30 |
    31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
    Introduction
    39 |
    40 |
    41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
    47 | Member Functions 48 |
    51 | 98 |
    99 |
    100 | 101 | 102 | 103 | 104 | 105 | 108 | 109 |
    106 | Member Data 107 |
    110 |
    111 | 112 | 116 |
    117 |
    118 |
    119 |

    Other Reference

    120 |
    121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 |
    Header
    129 |
    130 |
    131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 |
    139 |
    140 | 141 |
    144 |

     

    145 |

    146 |

    147 |
    149 | 150 | 151 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /Documentation/ASUnit_applescript/Classes/ASUnitSentinel/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ASUnitSentinel 5 | 6 | 7 | 8 | 9 | 135 | 151 | 163 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 282 |
    260 | 261 |

    ASUnitSentinel

    262 |
    263 | 264 | 265 | 266 | 267 |
    Declared In:
    268 |

    Introduction

    269 |

    270 |

    Sentinel object used to mark missing values. 271 |

    272 |
    Discussion
    273 |

    This is used, in particular, to catch a missing suite property in a test script. 274 |

    275 |

     

    276 |
    277 | 281 |
    283 | 284 | 285 | --------------------------------------------------------------------------------