bat/tests/syntax-tests/source/ActionScript/test.as
Martin Nordholts 68d525cd8b Don't add artificial newline to last line if --style=plain
This fixes #1438.

Note however, that using a pager such as less will add a newline itself.
So to actually not print a newline for such files, you need to either
disable paging:

  bat --style=plain --paging=never no-newline-at-end-of-file.txt

or use a "pager" that does not add a newline:

  bat --style=plain --pager=cat no-newline-at-end-of-file.txt

Note that we also update syntax tests file since a bunch of them had
missing newlines on the last lines.
2020-12-19 10:32:50 +01:00

76 lines
1.9 KiB
ActionScript
Vendored

import flash.events.*;
import flash.events.MouseEvent;
package TestSyntax {
public class TestSyntax extends flash.display.Sprite {
public static const TEST_CONSTANT:Number = 33.333;
var testAttribute:int = 1;
public namespace TestNamespace;
TestNamespace function Method2():void { }
/**
* Multi-line comment
*/
override public function set x(value:Number):void
{
super.x = Math.round(value);
}
/**
* Actual multi-line comment
* Takes up multiple lines
*/
override public function set y(value:Number):void
{
super.y = 0;
}
public function testFunction() {
var test:String = 'hello';
// arrays
var testArray:Array = ["a", "b", "c", "d"];
for (var i:uint = 0; i < testArray.length; i++)
trace(testArray[i]);
// objects
var testObject:Object = {foo: 20, bar: 40};
for (var key:String in testObject) {
trace(testObject[key]);
}
for each (var objectValue:int in testObject) {
trace(objectValue);
}
// dynamic variables
var testDynamic:*;
testDynamic = 75;
testDynamic = "Seventy-five";
// regex
var testRegExp:RegExp = /foo-\d+/i;
// XML
var testXML:XML =
<employee>
<firstName>Harold</firstName>
<lastName>Webster</lastName>
</employee>;
}
private function anotherFunc(a:int, arg2:uint, arg3:Function, ... args) {
}
[Embed(source="sound1.mp3")] public var soundCls:Class;
public function SoundAssetExample()
{
var mySound:SoundAsset = new soundCls() as SoundAsset;
var sndChannel:SoundChannel = mySound.play();
}
}
}