├── 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 |
16 |
67 | 68 | 69 | | |||||||||||||||||||||
16 |
85 | 86 | 87 | | ||||||||||||||||||||||||||||
16 |
85 | 86 | 87 | | ||||||||||||||||||||||||||||
16 |
85 | 86 | 87 | | ||||||||||||||||||||||||||||
16 |
86 | 87 | 88 | | ||||||||||||||||||||||||||||
16 |
87 | 88 | 89 | | ||||||||||||||||||||||||||||
16 |
87 | 88 | 89 | | ||||||||||||||||||||||||||||
16 |
87 | 88 | 89 | | ||||||||||||||||||||||||||||
16 |
110 | 111 | 112 | | |||||||||||||||||||||||||||||||||||
16 |
102 | 103 | 104 | | ||||||||||||||||||||||||||||
16 |
121 | 122 | 123 | | |||||||||||||||||||||||||||||||||||
16 |
137 | 138 | 139 | | ||||||||||||||||||||||||||||||||||||
| Fixture | create a common test fixture |
| Test Case | create the stimulus for a test case |
| Check | check the response for a test case |
| Test Suite | aggregate Test Cases |
| Test Runner | run a test suite and display results |
| Test Loader | aggregate test scripts |
16 |
145 | 146 | 147 | | |||||||||||||||||||||||||||||||||||
| 259 | |
260 |
261 | ASUnitSentinel262 |
Introduction269 | 270 |Sentinel object used to mark missing values. 271 | 272 |Discussion273 |This is used, in particular, to catch a missing suite property in a test script. 274 | 275 | 276 |277 | 281 | |
282 |